diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5d692c880..de12bc45c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,3 +8,5 @@ updates: ignore: - dependency-name: '*' update-types: ['version-update:semver-patch', 'version-update:semver-minor'] + cooldown: + default-days: 7 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9b4e9511d..6b597f83c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,8 @@ name: main on: [ push, pull_request ] +permissions: + contents: read + jobs: test: runs-on: ubuntu-latest @@ -7,13 +10,15 @@ jobs: fail-fast: false matrix: php-version: - - '8.2' + - '8.4' name: PHP ${{ matrix.php-version }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 @@ -22,7 +27,7 @@ jobs: coverage: none - name: Cache composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ~/.cache/composer key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} @@ -44,18 +49,20 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 + with: + persist-credentials: false - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.4 coverage: none extensions: bcmath, fileinfo, json, pdo tools: cs2pr - name: Cache composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ~/.cache/composer key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} @@ -71,15 +78,13 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 with: - ref: ${{ github.ref }} # Otherwise our annotated tag is not fetched and we cannot get correct version + persist-credentials: false + ref: ${{ github.ref }} # Otherwise our annotated tag is not fetched, and we cannot get correct version - - name: Get release info - run: git tag --format '%(contents:body)' --points-at > release-body.txt - - - uses: ncipollo/release-action@v1 + # Create release + - name: Create release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - bodyFile: release-body.txt + run: gh release create "$GITHUB_REF_NAME" --verify-tag --notes "$(git tag --format '%(contents:body)' --points-at)" diff --git a/.gitignore b/.gitignore index 15fbd282f..90de7c981 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ /.idea/ /vendor/ -/tests/Zend/Filter/_files/Compress/* /tests/Zend/Filter/_files/Users/* -/tests/Zend/Translate/Adapter/_files/zend_cache---internal-metadatas---testid -/tests/Zend/Translate/Adapter/_files/zend_cache---testid diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 72a11c4a3..d60b52c5e 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -8,6 +8,7 @@ ->in(__DIR__); return (new PhpCsFixer\Config()) + ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) ->setRiskyAllowed(false) ->setFinder($finder) ->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__)) diff --git a/composer.json b/composer.json index 19e256569..dbd5484fe 100644 --- a/composer.json +++ b/composer.json @@ -21,10 +21,10 @@ ] }, "require": { - "php": "^8.2" + "php": "^8.4" }, "require-dev": { - "phpunit/phpunit": "^9.6", - "friendsofphp/php-cs-fixer": "@stable" + "friendsofphp/php-cs-fixer": "@stable", + "phpunit/phpunit": "^12.5" } } diff --git a/composer.lock b/composer.lock index 1478e04bf..20f72b016 100644 --- a/composer.lock +++ b/composer.lock @@ -4,33 +4,105 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6f50c4da03eefced66bfcf0708c13160", + "content-hash": "692f19901adadd83598f4ee798f21cd8", "packages": [], "packages-dev": [ + { + "name": "clue/ndjson-react", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Clue\\React\\NDJson\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", + "keywords": [ + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-12-23T10:58:28+00:00" + }, { "name": "composer/pcre", - "version": "3.1.0", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, "require-dev": { - "phpstan/phpstan": "^1.3", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, "branch-alias": { "dev-main": "3.x-dev" } @@ -60,7 +132,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.0" + "source": "https://github.com/composer/pcre/tree/3.3.2" }, "funding": [ { @@ -76,28 +148,28 @@ "type": "tidelift" } ], - "time": "2022-11-17T09:50:14+00:00" + "time": "2024-11-12T16:29:46+00:00" }, { "name": "composer/semver", - "version": "3.3.2", + "version": "3.4.4", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", + "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.4", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { @@ -139,9 +211,9 @@ "versioning" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.3.2" + "source": "https://github.com/composer/semver/tree/3.4.4" }, "funding": [ { @@ -151,26 +223,22 @@ { "url": "https://github.com/composer", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" } ], - "time": "2022-04-01T19:23:25+00:00" + "time": "2025-08-20T19:15:30+00:00" }, { "name": "composer/xdebug-handler", - "version": "3.0.3", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "ced299686f41dce890debac69273b47ffe98a40c" + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", - "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", "shasum": "" }, "require": { @@ -181,7 +249,7 @@ "require-dev": { "phpstan/phpstan": "^1.0", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^6.0" + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" }, "type": "library", "autoload": { @@ -205,9 +273,9 @@ "performance" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" }, "funding": [ { @@ -223,115 +291,32 @@ "type": "tidelift" } ], - "time": "2022-02-25T21:32:43+00:00" + "time": "2024-05-06T16:37:16+00:00" }, { - "name": "doctrine/annotations", - "version": "2.0.1", + "name": "evenement/evenement", + "version": "v3.0.2", "source": { "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f" + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", - "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", "shasum": "" }, "require": { - "doctrine/lexer": "^2 || ^3", - "ext-tokenizer": "*", - "php": "^7.2 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^2.0", - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.8.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^5.4 || ^6", - "vimeo/psalm": "^4.10" - }, - "suggest": { - "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "support": { - "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/2.0.1" - }, - "time": "2023-02-02T22:02:53+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" + "php": ">=7.0" }, "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" + "phpunit/phpunit": "^9 || ^6" }, "type": "library", "autoload": { "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + "Evenement\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -340,65 +325,53 @@ ], "authors": [ { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" } ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "description": "Événement is a very simple event dispatching library for PHP", "keywords": [ - "constructor", - "instantiate" + "event-dispatcher", + "event-emitter" ], "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" + "time": "2023-08-08T05:53:35+00:00" }, { - "name": "doctrine/lexer", - "version": "3.0.0", + "name": "fidry/cpu-core-counter", + "version": "1.3.0", "source": { "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "84a527db05647743d50373e0ec53a152f2cde568" + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/84a527db05647743d50373e0ec53a152f2cde568", - "reference": "84a527db05647743d50373e0ec53a152f2cde568", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/db9508f7b1474469d9d3c53b86f817e344732678", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.9", - "phpunit/phpunit": "^9.5", - "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^5.0" + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" }, "type": "library", "autoload": { "psr-4": { - "Doctrine\\Common\\Lexer\\": "src" + "Fidry\\CpuCoreCounter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -407,97 +380,81 @@ ], "authors": [ { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" } ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "description": "Tiny utility to get the number of CPU cores.", "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" + "CPU", + "core" ], "support": { - "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/3.0.0" + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.3.0" }, "funding": [ { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", - "type": "tidelift" + "url": "https://github.com/theofidry", + "type": "github" } ], - "time": "2022-12-15T16:57:16+00:00" + "time": "2025-08-14T07:29:31+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.23.0", + "version": "v3.92.3", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "35af3cbbacfa91e164b252a28ec0b644f1ed4e78" + "reference": "2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/35af3cbbacfa91e164b252a28ec0b644f1ed4e78", - "reference": "35af3cbbacfa91e164b252a28ec0b644f1ed4e78", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8", + "reference": "2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8", "shasum": "" }, "require": { - "composer/semver": "^3.3", - "composer/xdebug-handler": "^3.0.3", - "doctrine/annotations": "^2", - "doctrine/lexer": "^2 || ^3", + "clue/ndjson-react": "^1.3", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.5", + "ext-filter": "*", + "ext-hash": "*", "ext-json": "*", "ext-tokenizer": "*", + "fidry/cpu-core-counter": "^1.3", "php": "^7.4 || ^8.0", - "sebastian/diff": "^4.0 || ^5.0", - "symfony/console": "^5.4 || ^6.0", - "symfony/event-dispatcher": "^5.4 || ^6.0", - "symfony/filesystem": "^5.4 || ^6.0", - "symfony/finder": "^5.4 || ^6.0", - "symfony/options-resolver": "^5.4 || ^6.0", - "symfony/polyfill-mbstring": "^1.27", - "symfony/polyfill-php80": "^1.27", - "symfony/polyfill-php81": "^1.27", - "symfony/process": "^5.4 || ^6.0", - "symfony/stopwatch": "^5.4 || ^6.0" + "react/child-process": "^0.6.6", + "react/event-loop": "^1.5", + "react/socket": "^1.16", + "react/stream": "^1.4", + "sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0", + "symfony/console": "^5.4.47 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/finder": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/options-resolver": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/polyfill-mbstring": "^1.33", + "symfony/polyfill-php80": "^1.33", + "symfony/polyfill-php81": "^1.33", + "symfony/polyfill-php84": "^1.33", + "symfony/process": "^5.4.47 || ^6.4.24 || ^7.2 || ^8.0", + "symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0" }, "require-dev": { - "facile-it/paraunit": "^1.3 || ^2.0", - "justinrainbow/json-schema": "^5.2", - "keradus/cli-executor": "^2.0", - "mikey179/vfsstream": "^1.6.11", - "php-coveralls/php-coveralls": "^2.5.3", - "php-cs-fixer/accessible-object": "^1.1", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", - "phpspec/prophecy": "^1.16", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5", - "phpunitgoodpractices/polyfill": "^1.6", - "phpunitgoodpractices/traits": "^1.9.2", - "symfony/phpunit-bridge": "^6.2.3", - "symfony/yaml": "^5.4 || ^6.0" + "facile-it/paraunit": "^1.3.1 || ^2.7", + "infection/infection": "^0.31.0", + "justinrainbow/json-schema": "^6.5", + "keradus/cli-executor": "^2.2", + "mikey179/vfsstream": "^1.6.12", + "php-coveralls/php-coveralls": "^2.9", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", + "phpunit/phpunit": "^9.6.25 || ^10.5.53 || ^11.5.34", + "symfony/polyfill-php85": "^1.33", + "symfony/var-dumper": "^5.4.48 || ^6.4.24 || ^7.3.2 || ^8.0", + "symfony/yaml": "^5.4.45 || ^6.4.24 || ^7.3.2 || ^8.0" }, "suggest": { "ext-dom": "For handling output formats in XML", @@ -510,7 +467,10 @@ "autoload": { "psr-4": { "PhpCsFixer\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/**/Internal/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -535,7 +495,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.23.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.3" }, "funding": [ { @@ -543,20 +503,20 @@ "type": "github" } ], - "time": "2023-08-14T12:27:35+00:00" + "time": "2025-12-18T10:45:02+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.13.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", "shasum": "" }, "require": { @@ -564,11 +524,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -594,7 +555,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" }, "funding": [ { @@ -602,29 +563,31 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2025-08-01T08:46:24+00:00" }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v5.7.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -632,7 +595,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.x-dev" } }, "autoload": { @@ -656,26 +619,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2025-12-06T11:56:16+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -716,9 +680,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -773,35 +743,34 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.27", + "version": "12.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" + "reference": "4a9739b51cbcb355f6e95659612f92e282a7077b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4a9739b51cbcb355f6e95659612f92e282a7077b", + "reference": "4a9739b51cbcb355f6e95659612f92e282a7077b", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "nikic/php-parser": "^5.7.0", + "php": ">=8.3", + "phpunit/php-file-iterator": "^6.0", + "phpunit/php-text-template": "^5.0", + "sebastian/complexity": "^5.0", + "sebastian/environment": "^8.0.3", + "sebastian/lines-of-code": "^4.0", + "sebastian/version": "^6.0", + "theseer/tokenizer": "^2.0.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.5.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -810,7 +779,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "12.5.x-dev" } }, "autoload": { @@ -839,40 +808,52 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/12.5.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-code-coverage", + "type": "tidelift" } ], - "time": "2023-07-26T13:44:30+00:00" + "time": "2025-12-24T07:03:04+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "961bc913d42fe24a257bfff826a5068079ac7782" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/961bc913d42fe24a257bfff826a5068079ac7782", + "reference": "961bc913d42fe24a257bfff826a5068079ac7782", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -899,7 +880,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.0" }, "funding": [ { @@ -907,28 +889,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2025-02-07T04:58:37+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/12b54e689b07a25a9b41e57736dfab6ec9ae5406", + "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.3" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "suggest": { "ext-pcntl": "*" @@ -936,7 +918,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -962,7 +944,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/6.0.0" }, "funding": [ { @@ -970,32 +953,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2025-02-07T04:58:58+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/e1367a453f0eda562eedb4f659e13aa900d66c53", + "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1021,7 +1004,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/5.0.0" }, "funding": [ { @@ -1029,32 +1013,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2025-02-07T04:59:16+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "8.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", + "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "8.0-dev" } }, "autoload": { @@ -1080,7 +1064,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/8.0.0" }, "funding": [ { @@ -1088,54 +1073,48 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2025-02-07T04:59:38+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.11", + "version": "12.5.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "810500e92855eba8a7a5319ae913be2da6f957b0" + "reference": "4ba0e923f9d3fc655de22f9547c01d15a41fc93a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0", - "reference": "810500e92855eba8a7a5319ae913be2da6f957b0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4ba0e923f9d3fc655de22f9547c01d15a41fc93a", + "reference": "4ba0e923f9d3fc655de22f9547c01d15a41fc93a", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" - }, - "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "myclabs/deep-copy": "^1.13.4", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.3", + "phpunit/php-code-coverage": "^12.5.1", + "phpunit/php-file-iterator": "^6.0.0", + "phpunit/php-invoker": "^6.0.0", + "phpunit/php-text-template": "^5.0.0", + "phpunit/php-timer": "^8.0.0", + "sebastian/cli-parser": "^4.2.0", + "sebastian/comparator": "^7.1.3", + "sebastian/diff": "^7.0.0", + "sebastian/environment": "^8.0.3", + "sebastian/exporter": "^7.0.2", + "sebastian/global-state": "^8.0.2", + "sebastian/object-enumerator": "^7.0.0", + "sebastian/type": "^6.0.3", + "sebastian/version": "^6.0.0", + "staabm/side-effects-detector": "^1.0.5" }, "bin": [ "phpunit" @@ -1143,7 +1122,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "12.5-dev" } }, "autoload": { @@ -1175,7 +1154,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11" + "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.4" }, "funding": [ { @@ -1186,61 +1165,20 @@ "url": "https://github.com/sebastianbergmann", "type": "github" }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, { "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "type": "tidelift" } ], - "time": "2023-08-19T07:10:56+00:00" - }, - { - "name": "psr/cache", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "shasum": "" - }, - "require": { - "php": ">=8.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "support": { - "source": "https://github.com/php-fig/cache/tree/3.0.0" - }, - "time": "2021-02-03T23:26:27+00:00" + "time": "2025-12-15T06:05:34+00:00" }, { "name": "psr/container", @@ -1347,16 +1285,16 @@ }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -1391,146 +1329,560 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { - "name": "sebastian/cli-parser", - "version": "1.0.1", + "name": "react/cache", + "version": "v1.2.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.7", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "970f0e71945556422ee4570ccbabaedc3cf04ad3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/970f0e71945556422ee4570ccbabaedc3cf04ad3", + "reference": "970f0e71945556422ee4570ccbabaedc3cf04ad3", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/socket": "^1.16", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src/" } }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.7" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-12-23T15:25:20+00:00" + }, + { + "name": "react/dns", + "version": "v1.14.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "7562c05391f42701c1fccf189c8225fece1cd7c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/7562c05391f42701c1fccf189c8225fece1cd7c3", + "reference": "7562c05391f42701c1fccf189c8225fece1cd7c3", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "React\\Dns\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.14.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", - "type": "github" + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2025-11-18T19:34:28+00:00" }, { - "name": "sebastian/code-unit", - "version": "1.0.8", + "name": "react/event-loop", + "version": "v1.6.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "url": "https://github.com/reactphp/event-loop.git", + "reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/ba276bda6083df7e0050fd9b33f66ad7a4ac747a", + "reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.6.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } + ], + "time": "2025-11-17T20:46:25+00:00" + }, + { + "name": "react/promise", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/23444f53a813a3296c1368bb104793ce8d88f04a", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.12.28 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" }, + "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.3.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", - "type": "github" + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2025-08-19T18:57:03+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "name": "react/socket", + "version": "v1.17.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "url": "https://github.com/reactphp/socket.git", + "reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/reactphp/socket/zipball/ef5b17b81f6f60504c539313f94f2d826c5faa08", + "reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08", "shasum": "" }, "require": { - "php": ">=7.3" + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.17.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-11-19T20:47:34+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "4.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "90f41072d220e5c40df6e8635f5dafba2d9d4d04" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/90f41072d220e5c40df6e8635f5dafba2d9d4d04", + "reference": "90f41072d220e5c40df6e8635f5dafba2d9d4d04", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.2-dev" } }, "autoload": { @@ -1545,49 +1897,68 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/4.2.0" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/cli-parser", + "type": "tidelift" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2025-09-14T09:36:45+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "7.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "dc904b4bb3ab070865fa4068cd84f3da8b945148" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dc904b4bb3ab070865fa4068cd84f3da8b945148", + "reference": "dc904b4bb3ab070865fa4068cd84f3da8b945148", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.3", + "sebastian/diff": "^7.0", + "sebastian/exporter": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.2" + }, + "suggest": { + "ext-bcmath": "For comparing BcMath\\Number objects" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "7.1-dev" } }, "autoload": { @@ -1626,41 +1997,54 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/7.1.3" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2025-08-20T11:27:00+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/bad4316aba5303d0221f43f8cee37eb58d384bbb", + "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1683,7 +2067,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/5.0.0" }, "funding": [ { @@ -1691,33 +2076,33 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2025-02-07T04:55:25+00:00" }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "7ab1ea946c012266ca32390913653d844ecd085f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7ab1ea946c012266ca32390913653d844ecd085f", + "reference": "7ab1ea946c012266ca32390913653d844ecd085f", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^12.0", + "symfony/process": "^7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1749,7 +2134,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/7.0.0" }, "funding": [ { @@ -1757,27 +2143,27 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2025-02-07T04:55:46+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "8.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "24a711b5c916efc6d6e62aa65aa2ec98fef77f68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/24a711b5c916efc6d6e62aa65aa2ec98fef77f68", + "reference": "24a711b5c916efc6d6e62aa65aa2ec98fef77f68", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "suggest": { "ext-posix": "*" @@ -1785,7 +2171,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "8.0-dev" } }, "autoload": { @@ -1804,7 +2190,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -1812,42 +2198,55 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/8.0.3" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/environment", + "type": "tidelift" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2025-08-12T14:11:56+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "016951ae10980765e4e7aee491eb288c64e505b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/016951ae10980765e4e7aee491eb288c64e505b7", + "reference": "016951ae10980765e4e7aee491eb288c64e505b7", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.3", + "sebastian/recursion-context": "^7.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1889,46 +2288,56 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/7.0.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2025-09-24T06:16:11+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "8.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "ef1377171613d09edd25b7816f05be8313f9115d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ef1377171613d09edd25b7816f05be8313f9115d", + "reference": "ef1377171613d09edd25b7816f05be8313f9115d", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.3", + "sebastian/object-reflector": "^5.0", + "sebastian/recursion-context": "^7.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "8.0-dev" } }, "autoload": { @@ -1947,47 +2356,60 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/8.0.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", + "type": "tidelift" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2025-08-29T11:29:25+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "97ffee3bcfb5805568d6af7f0f893678fc076d2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/97ffee3bcfb5805568d6af7f0f893678fc076d2f", + "reference": "97ffee3bcfb5805568d6af7f0f893678fc076d2f", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2010,7 +2432,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/4.0.0" }, "funding": [ { @@ -2018,34 +2441,34 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2025-02-07T04:57:28+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1effe8e9b8e068e9ae228e542d5d11b5d16db894", + "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.3", + "sebastian/object-reflector": "^5.0", + "sebastian/recursion-context": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -2067,7 +2490,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/7.0.0" }, "funding": [ { @@ -2075,32 +2499,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2025-02-07T04:57:48+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "4bfa827c969c98be1e527abd576533293c634f6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/4bfa827c969c98be1e527abd576533293c634f6a", + "reference": "4bfa827c969c98be1e527abd576533293c634f6a", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2122,7 +2546,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/5.0.0" }, "funding": [ { @@ -2130,32 +2555,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2025-02-07T04:58:17+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "0b01998a7d5b1f122911a66bebcb8d46f0c82d8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/0b01998a7d5b1f122911a66bebcb8d46f0c82d8c", + "reference": "0b01998a7d5b1f122911a66bebcb8d46f0c82d8c", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -2185,40 +2610,53 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/7.0.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" } ], - "time": "2023-02-03T06:07:39+00:00" + "time": "2025-08-13T04:44:59+00:00" }, { - "name": "sebastian/resource-operations", - "version": "3.0.3", + "name": "sebastian/type", + "version": "6.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "e549163b9760b8f71f191651d22acf32d56d6d4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/e549163b9760b8f71f191651d22acf32d56d6d4d", + "reference": "e549163b9760b8f71f191651d22acf32d56d6d4d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2233,47 +2671,58 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "issues": "https://github.com/sebastianbergmann/type/issues", + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/6.0.3" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/type", + "type": "tidelift" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2025-08-09T06:57:12+00:00" }, { - "name": "sebastian/type", - "version": "3.2.1", + "name": "sebastian/version", + "version": "6.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c", + "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c", "shasum": "" }, "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.5" + "php": ">=8.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2292,11 +2741,12 @@ "role": "lead" } ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "issues": "https://github.com/sebastianbergmann/version/issues", + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/6.0.0" }, "funding": [ { @@ -2304,100 +2754,95 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2025-02-07T05:00:38+00:00" }, { - "name": "sebastian/version", - "version": "3.0.2", + "name": "staabm/side-effects-detector", + "version": "1.0.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", "shasum": "" }, "require": { - "php": ">=7.3" + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" }, + "type": "library", "autoload": { "classmap": [ - "src/" + "lib/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://github.com/staabm", "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2024-10-20T05:08:20+00:00" }, { "name": "symfony/console", - "version": "v6.3.2", + "version": "v8.0.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898" + "reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/aa5d64ad3f63f2e48964fc81ee45cb318a723898", - "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898", + "url": "https://api.github.com/repos/symfony/console/zipball/6145b304a5c1ea0bdbd0b04d297a5864f9a7d587", + "reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", + "php": ">=8.4", + "symfony/polyfill-mbstring": "^1.0", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" + "symfony/string": "^7.4|^8.0" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/event-dispatcher": "^5.4|^6.0", - "symfony/lock": "^5.4|^6.0", - "symfony/process": "^5.4|^6.0", - "symfony/var-dumper": "^5.4|^6.0" + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2431,7 +2876,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.3.2" + "source": "https://github.com/symfony/console/tree/v8.0.3" }, "funding": [ { @@ -2442,25 +2887,29 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-07-19T20:17:28+00:00" + "time": "2025-12-23T14:52:06+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.3.0", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { @@ -2468,12 +2917,12 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -2498,7 +2947,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -2514,28 +2963,28 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.3.2", + "version": "v8.0.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e" + "reference": "573f95783a2ec6e38752979db139f09fec033f03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/adb01fe097a4ee930db9258a3cc906b5beb5cf2e", - "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/573f95783a2ec6e38752979db139f09fec033f03", + "reference": "573f95783a2ec6e38752979db139f09fec033f03", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.4", "symfony/event-dispatcher-contracts": "^2.5|^3" }, "conflict": { - "symfony/dependency-injection": "<5.4", + "symfony/security-http": "<7.4", "symfony/service-contracts": "<2.5" }, "provide": { @@ -2544,13 +2993,14 @@ }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/error-handler": "^5.4|^6.0", - "symfony/expression-language": "^5.4|^6.0", - "symfony/http-foundation": "^5.4|^6.0", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/error-handler": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/stopwatch": "^5.4|^6.0" + "symfony/stopwatch": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2578,7 +3028,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.3.2" + "source": "https://github.com/symfony/event-dispatcher/tree/v8.0.0" }, "funding": [ { @@ -2589,25 +3039,29 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-07-06T06:56:43+00:00" + "time": "2025-10-30T14:17:19+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.3.0", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" + "reference": "59eb412e93815df44f05f342958efa9f46b1e586" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", - "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586", + "reference": "59eb412e93815df44f05f342958efa9f46b1e586", "shasum": "" }, "require": { @@ -2616,12 +3070,12 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -2654,7 +3108,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.6.0" }, "funding": [ { @@ -2670,27 +3124,30 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/filesystem", - "version": "v6.3.1", + "version": "v8.0.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae" + "reference": "d937d400b980523dc9ee946bb69972b5e619058d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", - "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/d937d400b980523dc9ee946bb69972b5e619058d", + "reference": "d937d400b980523dc9ee946bb69972b5e619058d", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.4", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, + "require-dev": { + "symfony/process": "^7.4|^8.0" + }, "type": "library", "autoload": { "psr-4": { @@ -2717,7 +3174,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.3.1" + "source": "https://github.com/symfony/filesystem/tree/v8.0.1" }, "funding": [ { @@ -2728,32 +3185,36 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-06-01T08:30:39+00:00" + "time": "2025-12-01T09:13:36+00:00" }, { "name": "symfony/finder", - "version": "v6.3.3", + "version": "v8.0.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e" + "reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/9915db259f67d21eefee768c1abcf1cc61b1fc9e", - "reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e", + "url": "https://api.github.com/repos/symfony/finder/zipball/dd3a2953570a283a2ba4e17063bb98c734cf5b12", + "reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.4" }, "require-dev": { - "symfony/filesystem": "^6.0" + "symfony/filesystem": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2781,7 +3242,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.3.3" + "source": "https://github.com/symfony/finder/tree/v8.0.3" }, "funding": [ { @@ -2792,29 +3253,33 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-07-31T08:31:44+00:00" + "time": "2025-12-23T14:52:06+00:00" }, { "name": "symfony/options-resolver", - "version": "v6.3.0", + "version": "v8.0.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd" + "reference": "d2b592535ffa6600c265a3893a7f7fd2bad82dd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/a10f19f5198d589d5c33333cffe98dc9820332dd", - "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/d2b592535ffa6600c265a3893a7f7fd2bad82dd7", + "reference": "d2b592535ffa6600c265a3893a7f7fd2bad82dd7", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.4", "symfony/deprecation-contracts": "^2.5|^3" }, "type": "library", @@ -2848,7 +3313,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v6.3.0" + "source": "https://github.com/symfony/options-resolver/tree/v8.0.0" }, "funding": [ { @@ -2859,29 +3324,33 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-05-12T14:21:09+00:00" + "time": "2025-11-12T15:55:31+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -2891,12 +3360,9 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -2930,7 +3396,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0" }, "funding": [ { @@ -2941,41 +3407,42 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3011,7 +3478,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0" }, "funding": [ { @@ -3022,41 +3489,42 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2025-06-27T09:58:17+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3095,7 +3563,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0" }, "funding": [ { @@ -3106,29 +3574,34 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", "shasum": "" }, "require": { - "php": ">=7.1" + "ext-iconv": "*", + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -3138,12 +3611,9 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3178,7 +3648,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" }, "funding": [ { @@ -3189,38 +3659,39 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-12-23T08:48:59+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3261,7 +3732,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0" }, "funding": [ { @@ -3272,38 +3743,39 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2025-01-02T08:10:11+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.27.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3340,7 +3812,87 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php84", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/d8ced4d875142b6a7426000426b8abc631d6b191", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.33.0" }, "funding": [ { @@ -3351,29 +3903,33 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2025-06-24T13:30:11+00:00" }, { "name": "symfony/process", - "version": "v6.3.2", + "version": "v8.0.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "c5ce962db0d9b6e80247ca5eb9af6472bd4d7b5d" + "reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/c5ce962db0d9b6e80247ca5eb9af6472bd4d7b5d", - "reference": "c5ce962db0d9b6e80247ca5eb9af6472bd4d7b5d", + "url": "https://api.github.com/repos/symfony/process/zipball/a0a750500c4ce900d69ba4e9faf16f82c10ee149", + "reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.4" }, "type": "library", "autoload": { @@ -3401,7 +3957,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.3.2" + "source": "https://github.com/symfony/process/tree/v8.0.0" }, "funding": [ { @@ -3412,42 +3968,47 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-07-12T16:00:22+00:00" + "time": "2025-10-16T16:25:44+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.3.0", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43", + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43", "shasum": "" }, "require": { "php": ">=8.1", - "psr/container": "^2.0" + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { "ext-psr": "<1.1|>=2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -3483,7 +4044,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.1" }, "funding": [ { @@ -3494,29 +4055,33 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2025-07-15T11:30:57+00:00" }, { "name": "symfony/stopwatch", - "version": "v6.3.0", + "version": "v8.0.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2" + "reference": "67df1914c6ccd2d7b52f70d40cf2aea02159d942" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", - "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/67df1914c6ccd2d7b52f70d40cf2aea02159d942", + "reference": "67df1914c6ccd2d7b52f70d40cf2aea02159d942", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.4", "symfony/service-contracts": "^2.5|^3" }, "type": "library", @@ -3545,7 +4110,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v6.3.0" + "source": "https://github.com/symfony/stopwatch/tree/v8.0.0" }, "funding": [ { @@ -3556,43 +4121,47 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-02-16T10:14:28+00:00" + "time": "2025-08-04T07:36:47+00:00" }, { "name": "symfony/string", - "version": "v6.3.2", + "version": "v8.0.1", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "53d1a83225002635bca3482fcbf963001313fb68" + "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", - "reference": "53d1a83225002635bca3482fcbf963001313fb68", + "url": "https://api.github.com/repos/symfony/string/zipball/ba65a969ac918ce0cc3edfac6cdde847eba231dc", + "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.0", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=8.4", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-intl-grapheme": "^1.33", + "symfony/polyfill-intl-normalizer": "^1.0", + "symfony/polyfill-mbstring": "^1.0" }, "conflict": { "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0", - "symfony/http-client": "^5.4|^6.0", - "symfony/intl": "^6.2", + "symfony/emoji": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0" + "symfony/var-exporter": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3631,7 +4200,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.3.2" + "source": "https://github.com/symfony/string/tree/v8.0.1" }, "funding": [ { @@ -3642,32 +4211,36 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-07-05T08:41:27+00:00" + "time": "2025-12-01T09:13:36+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "7989e43bf381af0eac72e4f0ca5bcbfa81658be4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/7989e43bf381af0eac72e4f0ca5bcbfa81658be4", + "reference": "7989e43bf381af0eac72e4f0ca5bcbfa81658be4", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" + "php": "^8.1" }, "type": "library", "autoload": { @@ -3689,7 +4262,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/2.0.1" }, "funding": [ { @@ -3697,7 +4270,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2025-12-08T11:19:18+00:00" } ], "aliases": [], @@ -3708,8 +4281,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.2" + "php": "^8.4" }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform-dev": {}, + "plugin-api-version": "2.9.0" } diff --git a/library/Zend/Acl.php b/library/Zend/Acl.php index 8d5539d11..3dfe20d1c 100644 --- a/library/Zend/Acl.php +++ b/library/Zend/Acl.php @@ -1,4 +1,5 @@ getResourceId(); if ($this->has($resourceId)) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Resource id '$resourceId' already exists in the ACL"); } @@ -312,8 +282,6 @@ public function addResource($resource, $parent = null) } $resourceParent = $this->get($resourceParentId); } catch (Zend_Acl_Exception $e) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Parent Resource id '$resourceParentId' does not exist", 0, $e); } $this->_resources[$resourceParentId]['children'][$resourceId] = $resource; @@ -364,8 +332,6 @@ public function get($resource) } if (!$this->has($resource)) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Resource '$resourceId' not found"); } @@ -413,8 +379,6 @@ public function inherits($resource, $inherit, $onlyParent = false) $resourceId = $this->get($resource)->getResourceId(); $inheritId = $this->get($inherit)->getResourceId(); } catch (Zend_Acl_Exception $e) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e); } @@ -454,8 +418,6 @@ public function remove($resource) try { $resourceId = $this->get($resource)->getResourceId(); } catch (Zend_Acl_Exception $e) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e); } @@ -623,10 +585,8 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr // ensure that the rule type is valid; normalize input to uppercase $type = strtoupper($type); if (self::TYPE_ALLOW !== $type && self::TYPE_DENY !== $type) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Unsupported rule type; must be either '" . self::TYPE_ALLOW . "' or '" - . self::TYPE_DENY . "'"); + . self::TYPE_DENY . "'"); } // ensure that all specified Roles exist; normalize input to array of Role objects or null @@ -803,10 +763,8 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr break; default: - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Unsupported operation; must be either '" . self::OP_ADD . "' or '" - . self::OP_REMOVE . "'"); + . self::OP_REMOVE . "'"); } return $this; @@ -977,11 +935,6 @@ protected function _roleDFSVisitAllPrivileges(Zend_Acl_Role_Interface $role, ?Ze &$dfs = null) { if (null === $dfs) { - /** - * @see Zend_Acl_Exception - */ - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('$dfs parameter may not be null'); } @@ -1019,11 +972,6 @@ protected function _roleDFSOnePrivilege(Zend_Acl_Role_Interface $role, ?Zend_Acl $privilege = null) { if (null === $privilege) { - /** - * @see Zend_Acl_Exception - */ - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('$privilege parameter may not be null'); } @@ -1064,20 +1012,10 @@ protected function _roleDFSVisitOnePrivilege(Zend_Acl_Role_Interface $role, ?Zen $privilege = null, &$dfs = null) { if (null === $privilege) { - /** - * @see Zend_Acl_Exception - */ - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('$privilege parameter may not be null'); } if (null === $dfs) { - /** - * @see Zend_Acl_Exception - */ - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('$dfs parameter may not be null'); } @@ -1221,20 +1159,6 @@ protected function &_getRules(?Zend_Acl_Resource_Interface $resource = null, ?Ze return $visitor['byRoleId'][$roleId]; } - /** - * @return array of registered roles (Deprecated) - * - * @deprecated Deprecated since version 1.10 (December 2009) - */ - public function getRegisteredRoles() - { - trigger_error('The method getRegisteredRoles() was deprecated as of ' - . 'version 1.0, and may be removed. You\'re encouraged ' - . 'to use getRoles() instead.'); - - return $this->_getRoleRegistry()->getRoles(); - } - /** * Returns an array of registered roles. * diff --git a/library/Zend/Acl/Assert/Interface.php b/library/Zend/Acl/Assert/Interface.php index 624091b4a..73ca847d1 100644 --- a/library/Zend/Acl/Assert/Interface.php +++ b/library/Zend/Acl/Assert/Interface.php @@ -1,4 +1,5 @@ getRoleId(); if ($this->has($roleId)) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; - throw new Zend_Acl_Role_Registry_Exception("Role id '$roleId' already exists in the registry"); } @@ -72,10 +63,6 @@ public function add(Zend_Acl_Role_Interface $role, $parents = null) if (!is_array($parents)) { $parents = [$parents]; } - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; foreach ($parents as $parent) { try { if ($parent instanceof Zend_Acl_Role_Interface) { @@ -119,11 +106,6 @@ public function get($role) } if (!$this->has($role)) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; - throw new Zend_Acl_Role_Registry_Exception("Role '$roleId' not found"); } @@ -190,11 +172,6 @@ public function getParents($role) */ public function inherits($role, $inherit, $onlyParents = false) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; - try { $roleId = $this->get($role)->getRoleId(); $inheritId = $this->get($inherit)->getRoleId(); @@ -228,11 +205,6 @@ public function inherits($role, $inherit, $onlyParents = false) */ public function remove($role) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; - try { $roleId = $this->get($role)->getRoleId(); } catch (Zend_Acl_Role_Registry_Exception $e) { diff --git a/library/Zend/Acl/Role/Registry/Exception.php b/library/Zend/Acl/Role/Registry/Exception.php index b2d405dd1..dc3559fcc 100644 --- a/library/Zend/Acl/Role/Registry/Exception.php +++ b/library/Zend/Acl/Role/Registry/Exception.php @@ -1,4 +1,5 @@ _environment = (string) $environment; - require_once 'Zend/Loader/Autoloader.php'; $this->_autoloader = Zend_Loader_Autoloader::getInstance(); $this->_autoloader->suppressNotFoundWarnings($suppressNotFoundWarnings); diff --git a/library/Zend/Application/Bootstrap/Bootstrap.php b/library/Zend/Application/Bootstrap/Bootstrap.php index 8503241d7..4d5b14d75 100644 --- a/library/Zend/Application/Bootstrap/Bootstrap.php +++ b/library/Zend/Application/Bootstrap/Bootstrap.php @@ -1,4 +1,5 @@ getCacheManager(); - } - - /** - * Retrieve Zend_Cache_Manager instance. - * - * @return Zend_Cache_Manager - */ - public function getCacheManager() - { - if (null === $this->_manager) { - $this->_manager = new Zend_Cache_Manager(); - - $options = $this->getOptions(); - foreach ($options as $key => $value) { - // Cache templates - if ($this->_manager->hasCacheTemplate($key)) { - $this->_manager->setTemplateOptions($key, $value); - } else { - $this->_manager->setCacheTemplate($key, $value); - } - } - } - - return $this->_manager; - } -} diff --git a/library/Zend/Application/Resource/Db.php b/library/Zend/Application/Resource/Db.php deleted file mode 100644 index 0e4549832..000000000 --- a/library/Zend/Application/Resource/Db.php +++ /dev/null @@ -1,199 +0,0 @@ -_adapter = $adapter; - - return $this; - } - - /** - * Adapter type to use. - * - * @return string - */ - public function getAdapter() - { - return $this->_adapter; - } - - /** - * Set the adapter params. - * - * @return Zend_Application_Resource_Db - */ - public function setParams(array $params) - { - $this->_params = $params; - - return $this; - } - - /** - * Adapter parameters. - * - * @return array - */ - public function getParams() - { - return $this->_params; - } - - /** - * Set whether to use this as default table adapter. - * - * @param bool $isDefaultTableAdapter - * - * @return Zend_Application_Resource_Db - */ - public function setIsDefaultTableAdapter($isDefaultTableAdapter) - { - $this->_isDefaultTableAdapter = $isDefaultTableAdapter; - - return $this; - } - - /** - * Is this adapter the default table adapter? - * - * @return bool - */ - public function isDefaultTableAdapter() - { - return $this->_isDefaultTableAdapter; - } - - /** - * Retrieve initialized DB connection. - * - * @return null|Zend_Db_Adapter_Abstract - */ - public function getDbAdapter() - { - if ((null === $this->_db) - && (null !== ($adapter = $this->getAdapter())) - ) { - $this->_db = Zend_Db::factory($adapter, $this->getParams()); - - if ($this->_db instanceof Zend_Db_Adapter_Abstract - && $this->isDefaultTableAdapter() - ) { - Zend_Db_Table::setDefaultAdapter($this->_db); - } - } - - return $this->_db; - } - - /** - * Defined by Zend_Application_Resource_Resource. - * - * @return null|Zend_Db_Adapter_Abstract - */ - public function init() - { - if (null !== ($db = $this->getDbAdapter())) { - return $db; - } - - return null; - } - - /** - * Set the default metadata cache. - * - * @param string|Zend_Cache_Core $cache - * - * @return Zend_Application_Resource_Db - */ - public function setDefaultMetadataCache($cache) - { - $metadataCache = null; - - if (is_string($cache)) { - $bootstrap = $this->getBootstrap(); - if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper - && $bootstrap->hasPluginResource('CacheManager') - ) { - $cacheManager = $bootstrap->bootstrap('CacheManager') - ->getResource('CacheManager'); - if (null !== $cacheManager && $cacheManager->hasCache($cache)) { - $metadataCache = $cacheManager->getCache($cache); - } - } - } elseif ($cache instanceof Zend_Cache_Core) { - $metadataCache = $cache; - } - - if ($metadataCache instanceof Zend_Cache_Core) { - Zend_Db_Table::setDefaultMetadataCache($metadataCache); - } - - return $this; - } -} diff --git a/library/Zend/Application/Resource/Exception.php b/library/Zend/Application/Resource/Exception.php index a97bc3951..938709d0d 100644 --- a/library/Zend/Application/Resource/Exception.php +++ b/library/Zend/Application/Resource/Exception.php @@ -1,4 +1,5 @@ setDispatcher(new $dispatchClass((array) $value['params'])); diff --git a/library/Zend/Application/Resource/Layout.php b/library/Zend/Application/Resource/Layout.php index b3cb418a9..8877c9f56 100644 --- a/library/Zend/Application/Resource/Layout.php +++ b/library/Zend/Application/Resource/Layout.php @@ -1,4 +1,5 @@ _locale; } - - /** - * Set the cache. - * - * @param string|Zend_Cache_Core $cache - * - * @return Zend_Application_Resource_Locale - */ - public function setCache($cache) - { - if (is_string($cache)) { - $bootstrap = $this->getBootstrap(); - if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper - && $bootstrap->hasPluginResource('CacheManager') - ) { - $cacheManager = $bootstrap->bootstrap('CacheManager') - ->getResource('CacheManager'); - if (null !== $cacheManager && $cacheManager->hasCache($cache)) { - $cache = $cacheManager->getCache($cache); - } - } - } - - if ($cache instanceof Zend_Cache_Core) { - Zend_Locale::setCache($cache); - } - - return $this; - } } diff --git a/library/Zend/Application/Resource/Mail.php b/library/Zend/Application/Resource/Mail.php index abcfe5e9e..4bdf271ea 100644 --- a/library/Zend/Application/Resource/Mail.php +++ b/library/Zend/Application/Resource/Mail.php @@ -1,4 +1,5 @@ getUserAgent(); - - // Optionally seed the UserAgent view helper - $bootstrap = $this->getBootstrap(); - if ($bootstrap->hasResource('view') || $bootstrap->hasPluginResource('view')) { - $bootstrap->bootstrap('view'); - $view = $bootstrap->getResource('view'); - if (null !== $view) { - $view->userAgent($userAgent); - } - } - - return $userAgent; - } - - /** - * Get UserAgent instance. - * - * @return Zend_Http_UserAgent - */ - public function getUserAgent() - { - if (null === $this->_userAgent) { - $options = $this->getOptions(); - $this->_userAgent = new Zend_Http_UserAgent($options); - } - - return $this->_userAgent; - } -} diff --git a/library/Zend/Application/Resource/View.php b/library/Zend/Application/Resource/View.php index fa88d6cf6..ad10373f7 100644 --- a/library/Zend/Application/Resource/View.php +++ b/library/Zend/Application/Resource/View.php @@ -1,4 +1,5 @@ setBackend($backendObject); - - return $frontendObject; - } - - /** - * Backend Constructor. - * - * @param string $backend - * @param array $backendOptions - * @param bool $customBackendNaming - * @param bool $autoload - * - * @return Zend_Cache_Backend - */ - public static function _makeBackend($backend, $backendOptions, $customBackendNaming = false, $autoload = false) - { - if (!$customBackendNaming) { - $backend = self::_normalizeName($backend); - } - if (in_array($backend, Zend_Cache::$standardBackends)) { - // we use a standard backend - $backendClass = 'Zend_Cache_Backend_' . $backend; - // security controls are explicit - require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php'; - } else { - // we use a custom backend - if (!preg_match('~^[\w\\\\]+$~D', $backend)) { - Zend_Cache::throwException("Invalid backend name [$backend]"); - } - if (!$customBackendNaming) { - // we use this boolean to avoid an API break - $backendClass = 'Zend_Cache_Backend_' . $backend; - } else { - $backendClass = $backend; - } - if (!$autoload) { - $file = str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php'; - if (!(self::_isReadable($file))) { - self::throwException("file $file not found in include_path"); - } - require_once $file; - } - } - - return new $backendClass($backendOptions); - } - - /** - * Frontend Constructor. - * - * @param string $frontend - * @param array $frontendOptions - * @param bool $customFrontendNaming - * @param bool $autoload - * - * @return Zend_Cache_Core|Zend_Cache_Frontend - */ - public static function _makeFrontend($frontend, $frontendOptions = [], $customFrontendNaming = false, $autoload = false) - { - if (!$customFrontendNaming) { - $frontend = self::_normalizeName($frontend); - } - if (in_array($frontend, self::$standardFrontends)) { - // we use a standard frontend - // For perfs reasons, with frontend == 'Core', we can interact with the Core itself - $frontendClass = 'Zend_Cache_' . ($frontend != 'Core' ? 'Frontend_' : '') . $frontend; - // security controls are explicit - require_once str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php'; - } else { - // we use a custom frontend - if (!preg_match('~^[\w\\\\]+$~D', $frontend)) { - Zend_Cache::throwException("Invalid frontend name [$frontend]"); - } - if (!$customFrontendNaming) { - // we use this boolean to avoid an API break - $frontendClass = 'Zend_Cache_Frontend_' . $frontend; - } else { - $frontendClass = $frontend; - } - if (!$autoload) { - $file = str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php'; - if (!(self::_isReadable($file))) { - self::throwException("file $file not found in include_path"); - } - require_once $file; - } - } - - return new $frontendClass($frontendOptions); - } - - /** - * Throw an exception. - * - * Note : for perf reasons, the "load" of Zend/Cache/Exception is dynamic - * - * @param string $msg Message for the exception - */ - public static function throwException($msg, ?Exception $e = null) - { - // For perfs reasons, we use this dynamic inclusion - require_once 'Zend/Cache/Exception.php'; - - throw new Zend_Cache_Exception($msg, 0, $e); - } - - /** - * Normalize frontend and backend names to allow multiple words TitleCased. - * - * @param string $name Name to normalize - * - * @return string - */ - protected static function _normalizeName($name) - { - $name = ucfirst(strtolower($name)); - $name = str_replace(['-', '_', '.'], ' ', $name); - $name = ucwords($name); - $name = str_replace(' ', '', $name); - if (stripos($name, 'ZendServer') === 0) { - $name = 'ZendServer_' . substr($name, strlen('ZendServer')); - } - - return $name; - } - - /** - * Returns TRUE if the $filename is readable, or FALSE otherwise. - * This function uses the PHP include_path, where PHP's is_readable() - * does not. - * - * Note : this method comes from Zend_Loader (see #ZF-2891 for details) - * - * @param string $filename - * - * @return bool - */ - private static function _isReadable($filename) - { - if (!$fh = @fopen($filename, 'r', true)) { - return false; - } - @fclose($fh); - - return true; - } -} diff --git a/library/Zend/Cache/Backend.php b/library/Zend/Cache/Backend.php deleted file mode 100644 index 3fe2558c7..000000000 --- a/library/Zend/Cache/Backend.php +++ /dev/null @@ -1,235 +0,0 @@ - (int) lifetime : - * - Cache lifetime (in seconds) - * - If null, the cache is valid forever - * - * @var array directives - */ - protected $_directives = [ - 'lifetime' => 3600, - 'logging' => false, - 'logger' => null, - ]; - - /** - * Available options. - * - * @var array available options - */ - protected $_options = []; - - /** - * Constructor. - * - * @param array $options Associative array of options - */ - public function __construct(array $options = []) - { - foreach ($options as $name => $value) { - $this->setOption($name, $value); - } - } - - /** - * Set the frontend directives. - * - * @param array $directives Assoc of directives - */ - public function setDirectives($directives) - { - if (!is_array($directives)) { - Zend_Cache::throwException('Directives parameter must be an array'); - } - foreach ($directives as $name => $value) { - if (!is_string($name)) { - Zend_Cache::throwException("Incorrect option name : $name"); - } - $name = strtolower($name); - if (array_key_exists($name, $this->_directives)) { - $this->_directives[$name] = $value; - } - } - } - - /** - * Set an option. - * - * @param string $name - * @param mixed $value - */ - public function setOption($name, $value) - { - if (!is_string($name)) { - Zend_Cache::throwException("Incorrect option name : $name"); - } - $name = strtolower($name); - if (array_key_exists($name, $this->_options)) { - $this->_options[$name] = $value; - } - } - - /** - * Returns an option. - * - * @param string $name Optional, the options name to return - * - * @return mixed - */ - public function getOption($name) - { - $name = strtolower($name); - - if (array_key_exists($name, $this->_options)) { - return $this->_options[$name]; - } - - if (array_key_exists($name, $this->_directives)) { - return $this->_directives[$name]; - } - - Zend_Cache::throwException("Incorrect option name : {$name}"); - } - - /** - * Get the life time. - * - * if $specificLifetime is not false, the given specific life time is used - * else, the global lifetime is used - * - * @param int $specificLifetime - * - * @return int Cache life time - */ - public function getLifetime($specificLifetime) - { - if ($specificLifetime === false) { - return $this->_directives['lifetime']; - } - - return $specificLifetime; - } - - /** - * Return true if the automatic cleaning is available for the backend. - * - * DEPRECATED : use getCapabilities() instead - * - * @deprecated - * - * @return bool - */ - public function isAutomaticCleaningAvailable() - { - return true; - } - - /** - * Determine system TMP directory and detect if we have read access. - * - * inspired from Zend_File_Transfer_Adapter_Abstract - * - * @return string - */ - public function getTmpDir() - { - $tmpdir = []; - foreach ([$_ENV, $_SERVER] as $tab) { - foreach (['TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot'] as $key) { - if (isset($tab[$key]) && is_string($tab[$key])) { - if (($key == 'windir') or ($key == 'SystemRoot')) { - $dir = realpath($tab[$key] . '\\temp'); - } else { - $dir = realpath($tab[$key]); - } - if ($this->_isGoodTmpDir($dir)) { - return $dir; - } - } - } - } - $upload = ini_get('upload_tmp_dir'); - if ($upload) { - $dir = realpath($upload); - if ($this->_isGoodTmpDir($dir)) { - return $dir; - } - } - if (function_exists('sys_get_temp_dir')) { - $dir = sys_get_temp_dir(); - if ($this->_isGoodTmpDir($dir)) { - return $dir; - } - } - // Attemp to detect by creating a temporary file - $tempFile = tempnam(md5(uniqid(random_int(0, mt_getrandmax()), true)), ''); - if ($tempFile) { - $dir = realpath(dirname($tempFile)); - unlink($tempFile); - if ($this->_isGoodTmpDir($dir)) { - return $dir; - } - } - if ($this->_isGoodTmpDir('/tmp')) { - return '/tmp'; - } - if ($this->_isGoodTmpDir('\\temp')) { - return '\\temp'; - } - Zend_Cache::throwException('Could not determine temp directory, please specify a cache_dir manually'); - } - - /** - * Verify if the given temporary directory is readable and writable. - * - * @param string $dir temporary directory - * - * @return bool true if the directory is ok - */ - protected function _isGoodTmpDir($dir) - { - if (is_readable($dir)) { - if (is_writable($dir)) { - return true; - } - } - - return false; - } - - /** - * Log a message at the WARN (4) priority. - * - * @param string $message - * @param int $priority - */ - protected function _log($message, $priority = 4) - { - } -} diff --git a/library/Zend/Cache/Backend/BlackHole.php b/library/Zend/Cache/Backend/BlackHole.php deleted file mode 100644 index 4d977875b..000000000 --- a/library/Zend/Cache/Backend/BlackHole.php +++ /dev/null @@ -1,252 +0,0 @@ - infinite lifetime) - * - * @return bool true if no problem - */ - public function save($data, $id, $tags = [], $specificLifetime = false) - { - return true; - } - - /** - * Remove a cache record. - * - * @param string $id cache id - * - * @return bool true if no problem - */ - public function remove($id) - { - return true; - } - - /** - * Clean some cache records. - * - * Available modes are : - * 'all' (default) => remove all cache entries ($tags is not used) - * 'old' => remove too old cache entries ($tags is not used) - * 'matchingTag' => remove cache entries matching all given tags - * ($tags can be an array of strings or a single string) - * 'notMatchingTag' => remove cache entries not matching one of the given tags - * ($tags can be an array of strings or a single string) - * 'matchingAnyTag' => remove cache entries matching any given tags - * ($tags can be an array of strings or a single string) - * - * @param string $mode clean mode - * @param tags array $tags array of tags - * - * @return bool true if no problem - */ - public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = []) - { - return true; - } - - /** - * Return an array of stored cache ids. - * - * @return array array of stored cache ids (string) - */ - public function getIds() - { - return []; - } - - /** - * Return an array of stored tags. - * - * @return array array of stored tags (string) - */ - public function getTags() - { - return []; - } - - /** - * Return an array of stored cache ids which match given tags. - * - * In case of multiple tags, a logical AND is made between tags - * - * @param array $tags array of tags - * - * @return array array of matching cache ids (string) - */ - public function getIdsMatchingTags($tags = []) - { - return []; - } - - /** - * Return an array of stored cache ids which don't match given tags. - * - * In case of multiple tags, a logical OR is made between tags - * - * @param array $tags array of tags - * - * @return array array of not matching cache ids (string) - */ - public function getIdsNotMatchingTags($tags = []) - { - return []; - } - - /** - * Return an array of stored cache ids which match any given tags. - * - * In case of multiple tags, a logical AND is made between tags - * - * @param array $tags array of tags - * - * @return array array of any matching cache ids (string) - */ - public function getIdsMatchingAnyTags($tags = []) - { - return []; - } - - /** - * Return the filling percentage of the backend storage. - * - * @return int integer between 0 and 100 - */ - public function getFillingPercentage() - { - return 0; - } - - /** - * Return an array of metadatas for the given cache id. - * - * The array must include these keys : - * - expire : the expire timestamp - * - tags : a string array of tags - * - mtime : timestamp of last modification time - * - * @param string $id cache id - * - * @return array array of metadatas (false if the cache id is not found) - */ - public function getMetadatas($id) - { - return false; - } - - /** - * Give (if possible) an extra lifetime to the given cache id. - * - * @param string $id cache id - * @param int $extraLifetime - * - * @return bool true if ok - */ - public function touch($id, $extraLifetime) - { - return false; - } - - /** - * Return an associative array of capabilities (booleans) of the backend. - * - * The array must include these keys : - * - automatic_cleaning (is automating cleaning necessary) - * - tags (are tags supported) - * - expired_read (is it possible to read expired cache records - * (for doNotTestCacheValidity option for example)) - * - priority does the backend deal with priority when saving - * - infinite_lifetime (is infinite lifetime can work with this backend) - * - get_list (is it possible to get the list of cache ids and the complete list of tags) - * - * @return array associative of with capabilities - */ - public function getCapabilities() - { - return [ - 'automatic_cleaning' => true, - 'tags' => true, - 'expired_read' => true, - 'priority' => true, - 'infinite_lifetime' => true, - 'get_list' => true, - ]; - } - - /** - * PUBLIC METHOD FOR UNIT TESTING ONLY ! - * - * Force a cache record to expire - * - * @param string $id cache id - */ - public function ___expire($id) - { - } -} diff --git a/library/Zend/Cache/Backend/ExtendedInterface.php b/library/Zend/Cache/Backend/ExtendedInterface.php deleted file mode 100644 index 945924ab7..000000000 --- a/library/Zend/Cache/Backend/ExtendedInterface.php +++ /dev/null @@ -1,123 +0,0 @@ - (string) cache_dir : - * - Directory where to put the cache files - * - * =====> (boolean) file_locking : - * - Enable / disable file_locking - * - Can avoid cache corruption under bad circumstances but it doesn't work on multithread - * webservers and on NFS filesystems for example - * - * =====> (boolean) read_control : - * - Enable / disable read control - * - If enabled, a control key is embeded in cache file and this key is compared with the one - * calculated after the reading. - * - * =====> (string) read_control_type : - * - Type of read control (only if read control is enabled). Available values are : - * 'md5' for a md5 hash control (best but slowest) - * 'crc32' for a crc32 hash control (lightly less safe but faster, better choice) - * 'adler32' for an adler32 hash control (excellent choice too, faster than crc32) - * 'strlen' for a length only test (fastest) - * - * =====> (int) hashed_directory_level : - * - Hashed directory level - * - Set the hashed directory structure level. 0 means "no hashed directory - * structure", 1 means "one level of directory", 2 means "two levels"... - * This option can speed up the cache only when you have many thousands of - * cache file. Only specific benchs can help you to choose the perfect value - * for you. Maybe, 1 or 2 is a good start. - * - * =====> (int) hashed_directory_umask : - * - deprecated - * - Permissions for hashed directory structure - * - * =====> (int) hashed_directory_perm : - * - Permissions for hashed directory structure - * - * =====> (string) file_name_prefix : - * - prefix for cache files - * - be really carefull with this option because a too generic value in a system cache dir - * (like /tmp) can cause disasters when cleaning the cache - * - * =====> (int) cache_file_umask : - * - deprecated - * - Permissions for cache files - * - * =====> (int) cache_file_perm : - * - Permissions for cache files - * - * =====> (int) metatadatas_array_max_size : - * - max size for the metadatas array (don't change this value unless you - * know what you are doing) - * - * @var array available options - */ - protected $_options = [ - 'cache_dir' => null, - 'file_locking' => true, - 'read_control' => true, - 'read_control_type' => 'crc32', - 'hashed_directory_level' => 0, - 'hashed_directory_perm' => 0o700, - 'file_name_prefix' => 'zend_cache', - 'cache_file_perm' => 0o600, - 'metadatas_array_max_size' => 100, - ]; - - /** - * Array of metadatas (each item is an associative array). - * - * @var array - */ - protected $_metadatasArray = []; - - /** - * Constructor. - * - * @param array $options associative array of options - */ - public function __construct(array $options = []) - { - parent::__construct($options); - if ($this->_options['cache_dir'] !== null) { // particular case for this option - $this->setCacheDir($this->_options['cache_dir']); - } else { - $this->setCacheDir(self::getTmpDir() . DIRECTORY_SEPARATOR, false); - } - if (isset($this->_options['file_name_prefix'])) { // particular case for this option - if (!preg_match('~^[a-zA-Z0-9_]+$~D', $this->_options['file_name_prefix'])) { - Zend_Cache::throwException('Invalid file_name_prefix : must use only [a-zA-Z0-9_]'); - } - } - if ($this->_options['metadatas_array_max_size'] < 10) { - Zend_Cache::throwException('Invalid metadatas_array_max_size, must be > 10'); - } - - if (isset($options['hashed_directory_umask'])) { - // See #ZF-12047 - trigger_error("'hashed_directory_umask' is deprecated -> please use 'hashed_directory_perm' instead", E_USER_NOTICE); - if (!isset($options['hashed_directory_perm'])) { - $options['hashed_directory_perm'] = $options['hashed_directory_umask']; - } - } - if (isset($options['hashed_directory_perm']) && is_string($options['hashed_directory_perm'])) { - // See #ZF-4422 - $this->_options['hashed_directory_perm'] = octdec($this->_options['hashed_directory_perm']); - } - - if (isset($options['cache_file_umask'])) { - // See #ZF-12047 - trigger_error("'cache_file_umask' is deprecated -> please use 'cache_file_perm' instead", E_USER_NOTICE); - if (!isset($options['cache_file_perm'])) { - $options['cache_file_perm'] = $options['cache_file_umask']; - } - } - if (isset($options['cache_file_perm']) && is_string($options['cache_file_perm'])) { - // See #ZF-4422 - $this->_options['cache_file_perm'] = octdec($this->_options['cache_file_perm']); - } - } - - /** - * Set the cache_dir (particular case of setOption() method). - * - * @param string $value - * @param bool $trailingSeparator If true, add a trailing separator is necessary - */ - public function setCacheDir($value, $trailingSeparator = true) - { - if (!is_dir($value)) { - Zend_Cache::throwException(sprintf('cache_dir "%s" must be a directory', $value)); - } - if (!is_writable($value)) { - Zend_Cache::throwException(sprintf('cache_dir "%s" is not writable', $value)); - } - if ($trailingSeparator) { - // add a trailing DIRECTORY_SEPARATOR if necessary - $value = rtrim(realpath($value), '\\/') . DIRECTORY_SEPARATOR; - } - $this->_options['cache_dir'] = $value; - } - - /** - * Test if a cache is available for the given id and (if yes) return it (false else). - * - * @param string $id cache id - * @param bool $doNotTestCacheValidity if set to true, the cache validity won't be tested - * - * @return false|string cached datas - */ - public function load($id, $doNotTestCacheValidity = false) - { - if (!($this->_test($id, $doNotTestCacheValidity))) { - // The cache is not hit ! - return false; - } - $metadatas = $this->_getMetadatas($id); - $file = $this->_file($id); - $data = $this->_fileGetContents($file); - if ($this->_options['read_control']) { - $hashData = $this->_hash($data, $this->_options['read_control_type']); - $hashControl = $metadatas['hash']; - if ($hashData != $hashControl) { - // Problem detected by the read control ! - $this->_log('Zend_Cache_Backend_File::load() / read_control : stored hash and computed hash do not match'); - $this->remove($id); - - return false; - } - } - - return $data; - } - - /** - * Test if a cache is available or not (for the given id). - * - * @param string $id cache id - * - * @return mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record - */ - public function test($id) - { - clearstatcache(); - - return $this->_test($id, false); - } - - /** - * Save some string datas into a cache record. - * - * Note : $data is always "string" (serialization is done by the - * core not by the backend) - * - * @param string $data Datas to cache - * @param string $id Cache id - * @param array $tags Array of strings, the cache record will be tagged by each string entry - * @param bool|int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) - * - * @return bool true if no problem - */ - public function save($data, $id, $tags = [], $specificLifetime = false) - { - clearstatcache(); - $file = $this->_file($id); - $path = $this->_path($id); - if ($this->_options['hashed_directory_level'] > 0) { - if (!is_writable($path)) { - // maybe, we just have to build the directory structure - $this->_recursiveMkdirAndChmod($id); - } - if (!is_writable($path)) { - return false; - } - } - if ($this->_options['read_control']) { - $hash = $this->_hash($data, $this->_options['read_control_type']); - } else { - $hash = ''; - } - $metadatas = [ - 'hash' => $hash, - 'mtime' => time(), - 'expire' => $this->_expireTime($this->getLifetime($specificLifetime)), - 'tags' => $tags, - ]; - $res = $this->_setMetadatas($id, $metadatas); - if (!$res) { - $this->_log('Zend_Cache_Backend_File::save() / error on saving metadata'); - - return false; - } - $res = $this->_filePutContents($file, $data); - - return $res; - } - - /** - * Remove a cache record. - * - * @param string $id cache id - * - * @return bool true if no problem - */ - public function remove($id) - { - $file = $this->_file($id); - $boolRemove = $this->_remove($file); - $boolMetadata = $this->_delMetadatas($id); - - return $boolMetadata && $boolRemove; - } - - /** - * Clean some cache records. - * - * Available modes are : - * - * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) - * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) - * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags - * ($tags can be an array of strings or a single string) - * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} - * ($tags can be an array of strings or a single string) - * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags - * ($tags can be an array of strings or a single string) - * - * @param string $mode clean mode - * @param array $tags array of tags - * - * @return bool true if no problem - */ - public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = []) - { - // We use this protected method to hide the recursive stuff - clearstatcache(); - - return $this->_clean($this->_options['cache_dir'], $mode, $tags); - } - - /** - * Return an array of stored cache ids. - * - * @return array array of stored cache ids (string) - */ - public function getIds() - { - return $this->_get($this->_options['cache_dir'], 'ids', []); - } - - /** - * Return an array of stored tags. - * - * @return array array of stored tags (string) - */ - public function getTags() - { - return $this->_get($this->_options['cache_dir'], 'tags', []); - } - - /** - * Return an array of stored cache ids which match given tags. - * - * In case of multiple tags, a logical AND is made between tags - * - * @param array $tags array of tags - * - * @return array array of matching cache ids (string) - */ - public function getIdsMatchingTags($tags = []) - { - return $this->_get($this->_options['cache_dir'], 'matching', $tags); - } - - /** - * Return an array of stored cache ids which don't match given tags. - * - * In case of multiple tags, a logical OR is made between tags - * - * @param array $tags array of tags - * - * @return array array of not matching cache ids (string) - */ - public function getIdsNotMatchingTags($tags = []) - { - return $this->_get($this->_options['cache_dir'], 'notMatching', $tags); - } - - /** - * Return an array of stored cache ids which match any given tags. - * - * In case of multiple tags, a logical AND is made between tags - * - * @param array $tags array of tags - * - * @return array array of any matching cache ids (string) - */ - public function getIdsMatchingAnyTags($tags = []) - { - return $this->_get($this->_options['cache_dir'], 'matchingAny', $tags); - } - - /** - * Return the filling percentage of the backend storage. - * - * @return int integer between 0 and 100 - */ - public function getFillingPercentage() - { - $free = disk_free_space($this->_options['cache_dir']); - $total = disk_total_space($this->_options['cache_dir']); - if ($total == 0) { - Zend_Cache::throwException('can\'t get disk_total_space'); - } else { - if ($free >= $total) { - return 100; - } - - return (int) (100. * ($total - $free) / $total); - } - } - - /** - * Return an array of metadatas for the given cache id. - * - * The array must include these keys : - * - expire : the expire timestamp - * - tags : a string array of tags - * - mtime : timestamp of last modification time - * - * @param string $id cache id - * - * @return array array of metadatas (false if the cache id is not found) - */ - public function getMetadatas($id) - { - $metadatas = $this->_getMetadatas($id); - if (!$metadatas) { - return false; - } - if (time() > $metadatas['expire']) { - return false; - } - - return [ - 'expire' => $metadatas['expire'], - 'tags' => $metadatas['tags'], - 'mtime' => $metadatas['mtime'], - ]; - } - - /** - * Give (if possible) an extra lifetime to the given cache id. - * - * @param string $id cache id - * @param int $extraLifetime - * - * @return bool true if ok - */ - public function touch($id, $extraLifetime) - { - $metadatas = $this->_getMetadatas($id); - if (!$metadatas) { - return false; - } - if (time() > $metadatas['expire']) { - return false; - } - $newMetadatas = [ - 'hash' => $metadatas['hash'], - 'mtime' => time(), - 'expire' => $metadatas['expire'] + $extraLifetime, - 'tags' => $metadatas['tags'], - ]; - $res = $this->_setMetadatas($id, $newMetadatas); - if (!$res) { - return false; - } - - return true; - } - - /** - * Return an associative array of capabilities (booleans) of the backend. - * - * The array must include these keys : - * - automatic_cleaning (is automating cleaning necessary) - * - tags (are tags supported) - * - expired_read (is it possible to read expired cache records - * (for doNotTestCacheValidity option for example)) - * - priority does the backend deal with priority when saving - * - infinite_lifetime (is infinite lifetime can work with this backend) - * - get_list (is it possible to get the list of cache ids and the complete list of tags) - * - * @return array associative of with capabilities - */ - public function getCapabilities() - { - return [ - 'automatic_cleaning' => true, - 'tags' => true, - 'expired_read' => true, - 'priority' => false, - 'infinite_lifetime' => true, - 'get_list' => true, - ]; - } - - /** - * PUBLIC METHOD FOR UNIT TESTING ONLY ! - * - * Force a cache record to expire - * - * @param string $id cache id - */ - public function ___expire($id) - { - $metadatas = $this->_getMetadatas($id); - if ($metadatas) { - $metadatas['expire'] = 1; - $this->_setMetadatas($id, $metadatas); - } - } - - /** - * Get a metadatas record. - * - * @param string $id Cache id - * - * @return array|false Associative array of metadatas - */ - protected function _getMetadatas($id) - { - if (isset($this->_metadatasArray[$id])) { - return $this->_metadatasArray[$id]; - } - $metadatas = $this->_loadMetadatas($id); - if (!$metadatas) { - return false; - } - $this->_setMetadatas($id, $metadatas, false); - - return $metadatas; - } - - /** - * Set a metadatas record. - * - * @param string $id Cache id - * @param array $metadatas Associative array of metadatas - * @param bool $save optional pass false to disable saving to file - * - * @return bool True if no problem - */ - protected function _setMetadatas($id, $metadatas, $save = true) - { - if (count($this->_metadatasArray) >= $this->_options['metadatas_array_max_size']) { - $n = (int) ($this->_options['metadatas_array_max_size'] / 10); - $this->_metadatasArray = array_slice($this->_metadatasArray, $n); - } - if ($save) { - $result = $this->_saveMetadatas($id, $metadatas); - if (!$result) { - return false; - } - } - $this->_metadatasArray[$id] = $metadatas; - - return true; - } - - /** - * Drop a metadata record. - * - * @param string $id Cache id - * - * @return bool True if no problem - */ - protected function _delMetadatas($id) - { - if (isset($this->_metadatasArray[$id])) { - unset($this->_metadatasArray[$id]); - } - $file = $this->_metadatasFile($id); - - return $this->_remove($file); - } - - /** - * Clear the metadatas array. - */ - protected function _cleanMetadatas() - { - $this->_metadatasArray = []; - } - - /** - * Load metadatas from disk. - * - * @param string $id Cache id - * - * @return array|false Metadatas associative array - */ - protected function _loadMetadatas($id) - { - $file = $this->_metadatasFile($id); - $result = $this->_fileGetContents($file); - if (!$result) { - return false; - } - $tmp = @unserialize($result); - - return $tmp; - } - - /** - * Save metadatas to disk. - * - * @param string $id Cache id - * @param array $metadatas Associative array - * - * @return bool True if no problem - */ - protected function _saveMetadatas($id, $metadatas) - { - $file = $this->_metadatasFile($id); - $result = $this->_filePutContents($file, serialize($metadatas)); - if (!$result) { - return false; - } - - return true; - } - - /** - * Make and return a file name (with path) for metadatas. - * - * @param string $id Cache id - * - * @return string Metadatas file name (with path) - */ - protected function _metadatasFile($id) - { - $path = $this->_path($id); - $fileName = $this->_idToFileName('internal-metadatas---' . $id); - - return $path . $fileName; - } - - /** - * Check if the given filename is a metadatas one. - * - * @param string $fileName File name - * - * @return bool True if it's a metadatas one - */ - protected function _isMetadatasFile($fileName) - { - $id = $this->_fileNameToId($fileName); - if (substr($id, 0, 21) == 'internal-metadatas---') { - return true; - } - - return false; - } - - /** - * Remove a file. - * - * If we can't remove the file (because of locks or any problem), we will touch - * the file to invalidate it - * - * @param string $file Complete file path - * - * @return bool True if ok - */ - protected function _remove($file) - { - if (!is_file($file)) { - return false; - } - if (!@unlink($file)) { - // we can't remove the file (because of locks or any problem) - $this->_log("Zend_Cache_Backend_File::_remove() : we can't remove $file"); - - return false; - } - - return true; - } - - /** - * Clean some cache records (protected method used for recursive stuff). - * - * Available modes are : - * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) - * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) - * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags - * ($tags can be an array of strings or a single string) - * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} - * ($tags can be an array of strings or a single string) - * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags - * ($tags can be an array of strings or a single string) - * - * @param string $dir Directory to clean - * @param string $mode Clean mode - * @param array $tags Array of tags - * - * @return bool True if no problem - */ - protected function _clean($dir, $mode = Zend_Cache::CLEANING_MODE_ALL, $tags = []) - { - if (!is_dir($dir)) { - return false; - } - $result = true; - $prefix = $this->_options['file_name_prefix']; - $glob = @glob($dir . $prefix . '--*'); - if ($glob === false) { - // On some systems it is impossible to distinguish between empty match and an error. - return true; - } - $metadataFiles = []; - foreach ($glob as $file) { - if (is_file($file)) { - $fileName = basename($file); - if ($this->_isMetadatasFile($fileName)) { - // In CLEANING_MODE_ALL, we drop anything, even remainings old metadatas files. - // To do that, we need to save the list of the metadata files first. - if ($mode == Zend_Cache::CLEANING_MODE_ALL) { - $metadataFiles[] = $file; - } - - continue; - } - $id = $this->_fileNameToId($fileName); - $metadatas = $this->_getMetadatas($id); - if ($metadatas === false) { - $metadatas = ['expire' => 1, 'tags' => []]; - } - switch ($mode) { - case Zend_Cache::CLEANING_MODE_ALL: - $result = $result && $this->remove($id); - - break; - case Zend_Cache::CLEANING_MODE_OLD: - if (time() > $metadatas['expire']) { - $result = $this->remove($id) && $result; - } - - break; - case Zend_Cache::CLEANING_MODE_MATCHING_TAG: - $matching = true; - foreach ($tags as $tag) { - if (!in_array($tag, $metadatas['tags'])) { - $matching = false; - - break; - } - } - if ($matching) { - $result = $this->remove($id) && $result; - } - - break; - case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG: - $matching = false; - foreach ($tags as $tag) { - if (in_array($tag, $metadatas['tags'])) { - $matching = true; - - break; - } - } - if (!$matching) { - $result = $this->remove($id) && $result; - } - - break; - case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG: - $matching = false; - foreach ($tags as $tag) { - if (in_array($tag, $metadatas['tags'])) { - $matching = true; - - break; - } - } - if ($matching) { - $result = $this->remove($id) && $result; - } - - break; - default: - Zend_Cache::throwException('Invalid mode for clean() method'); - - break; - } - } - if ((is_dir($file)) and ($this->_options['hashed_directory_level'] > 0)) { - // Recursive call - $result = $this->_clean($file . DIRECTORY_SEPARATOR, $mode, $tags) && $result; - if ($mode == Zend_Cache::CLEANING_MODE_ALL) { - // we try to drop the structure too - @rmdir($file); - } - } - } - - // cycle through metadataFiles and delete orphaned ones - foreach ($metadataFiles as $file) { - if (file_exists($file)) { - $result = $this->_remove($file) && $result; - } - } - - return $result; - } - - protected function _get($dir, $mode, $tags = []) - { - if (!is_dir($dir)) { - return false; - } - $result = []; - $prefix = $this->_options['file_name_prefix']; - $glob = @glob($dir . $prefix . '--*'); - if ($glob === false) { - // On some systems it is impossible to distinguish between empty match and an error. - return []; - } - foreach ($glob as $file) { - if (is_file($file)) { - $fileName = basename($file); - $id = $this->_fileNameToId($fileName); - $metadatas = $this->_getMetadatas($id); - if ($metadatas === false) { - continue; - } - if (time() > $metadatas['expire']) { - continue; - } - switch ($mode) { - case 'ids': - $result[] = $id; - - break; - case 'tags': - $result = array_unique(array_merge($result, $metadatas['tags'])); - - break; - case 'matching': - $matching = true; - foreach ($tags as $tag) { - if (!in_array($tag, $metadatas['tags'])) { - $matching = false; - - break; - } - } - if ($matching) { - $result[] = $id; - } - - break; - case 'notMatching': - $matching = false; - foreach ($tags as $tag) { - if (in_array($tag, $metadatas['tags'])) { - $matching = true; - - break; - } - } - if (!$matching) { - $result[] = $id; - } - - break; - case 'matchingAny': - $matching = false; - foreach ($tags as $tag) { - if (in_array($tag, $metadatas['tags'])) { - $matching = true; - - break; - } - } - if ($matching) { - $result[] = $id; - } - - break; - default: - Zend_Cache::throwException('Invalid mode for _get() method'); - - break; - } - } - if ((is_dir($file)) and ($this->_options['hashed_directory_level'] > 0)) { - // Recursive call - $recursiveRs = $this->_get($file . DIRECTORY_SEPARATOR, $mode, $tags); - if ($recursiveRs === false) { - $this->_log('Zend_Cache_Backend_File::_get() / recursive call : can\'t list entries of "' . $file . '"'); - } else { - $result = array_unique(array_merge($result, $recursiveRs)); - } - } - } - - return array_unique($result); - } - - /** - * Compute & return the expire time. - * - * @param int $lifetime - * - * @return int expire time (unix timestamp) - */ - protected function _expireTime($lifetime) - { - if ($lifetime === null) { - return 9_999_999_999; - } - - return time() + $lifetime; - } - - /** - * Make a control key with the string containing datas. - * - * @param string $data Data - * @param string $controlType Type of control 'md5', 'crc32' or 'strlen' - * - * @return string Control key - */ - protected function _hash($data, $controlType) - { - switch ($controlType) { - case 'md5': - return md5($data); - case 'crc32': - return crc32($data); - case 'strlen': - return strlen($data); - case 'adler32': - return hash('adler32', $data); - default: - Zend_Cache::throwException("Incorrect hash function : $controlType"); - } - } - - /** - * Transform a cache id into a file name and return it. - * - * @param string $id Cache id - * - * @return string File name - */ - protected function _idToFileName($id) - { - $prefix = $this->_options['file_name_prefix']; - $result = $prefix . '---' . $id; - - return $result; - } - - /** - * Make and return a file name (with path). - * - * @param string $id Cache id - * - * @return string File name (with path) - */ - protected function _file($id) - { - $path = $this->_path($id); - $fileName = $this->_idToFileName($id); - - return $path . $fileName; - } - - /** - * Return the complete directory path of a filename (including hashedDirectoryStructure). - * - * @param string $id Cache id - * @param bool $parts if true, returns array of directory parts instead of single string - * - * @return string Complete directory path - */ - protected function _path($id, $parts = false) - { - $partsArray = []; - $root = $this->_options['cache_dir']; - $prefix = $this->_options['file_name_prefix']; - if ($this->_options['hashed_directory_level'] > 0) { - $hash = hash('adler32', $id); - for ($i = 0; $i < $this->_options['hashed_directory_level']; ++$i) { - $root = $root . $prefix . '--' . substr($hash, 0, $i + 1) . DIRECTORY_SEPARATOR; - $partsArray[] = $root; - } - } - if ($parts) { - return $partsArray; - } - - return $root; - } - - /** - * Make the directory strucuture for the given id. - * - * @param string $id cache id - * - * @return bool true - */ - protected function _recursiveMkdirAndChmod($id) - { - if ($this->_options['hashed_directory_level'] <= 0) { - return true; - } - $partsArray = $this->_path($id, true); - foreach ($partsArray as $part) { - if (!is_dir($part)) { - @mkdir($part, $this->_options['hashed_directory_perm']); - @chmod($part, $this->_options['hashed_directory_perm']); // see #ZF-320 (this line is required in some configurations) - } - } - - return true; - } - - /** - * Test if the given cache id is available (and still valid as a cache record). - * - * @param string $id Cache id - * @param bool $doNotTestCacheValidity If set to true, the cache validity won't be tested - * - * @return bool|mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record - */ - protected function _test($id, $doNotTestCacheValidity) - { - $metadatas = $this->_getMetadatas($id); - if (!$metadatas) { - return false; - } - if ($doNotTestCacheValidity || (time() <= $metadatas['expire'])) { - return $metadatas['mtime']; - } - - return false; - } - - /** - * Return the file content of the given file. - * - * @param string $file File complete path - * - * @return string File content (or false if problem) - */ - protected function _fileGetContents($file) - { - $result = false; - if (!is_file($file)) { - return false; - } - $f = @fopen($file, 'rb'); - if ($f) { - if ($this->_options['file_locking']) { - @flock($f, LOCK_SH); - } - $result = stream_get_contents($f); - if ($this->_options['file_locking']) { - @flock($f, LOCK_UN); - } - @fclose($f); - } - - return $result; - } - - /** - * Put the given string into the given file. - * - * @param string $file File complete path - * @param string $string String to put in file - * - * @return bool true if no problem - */ - protected function _filePutContents($file, $string) - { - $result = false; - $f = @fopen($file, 'ab+'); - if ($f) { - if ($this->_options['file_locking']) { - @flock($f, LOCK_EX); - } - fseek($f, 0); - ftruncate($f, 0); - $tmp = @fwrite($f, $string); - if (!($tmp === false)) { - $result = true; - } - @fclose($f); - } - @chmod($file, $this->_options['cache_file_perm']); - - return $result; - } - - /** - * Transform a file name into cache id and return it. - * - * @param string $fileName File name - * - * @return string Cache id - */ - protected function _fileNameToId($fileName) - { - $prefix = $this->_options['file_name_prefix']; - - return preg_replace('~^' . $prefix . '---(.*)$~', '$1', $fileName); - } -} diff --git a/library/Zend/Cache/Backend/Interface.php b/library/Zend/Cache/Backend/Interface.php deleted file mode 100644 index 79365dc53..000000000 --- a/library/Zend/Cache/Backend/Interface.php +++ /dev/null @@ -1,96 +0,0 @@ - infinite lifetime) - * - * @return bool true if no problem - */ - public function save($data, $id, $tags = [], $specificLifetime = false); - - /** - * Remove a cache record. - * - * @param string $id Cache id - * - * @return bool True if no problem - */ - public function remove($id); - - /** - * Clean some cache records. - * - * Available modes are : - * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) - * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) - * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags - * ($tags can be an array of strings or a single string) - * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} - * ($tags can be an array of strings or a single string) - * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags - * ($tags can be an array of strings or a single string) - * - * @param string $mode Clean mode - * @param array $tags Array of tags - * - * @return bool true if no problem - */ - public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = []); -} diff --git a/library/Zend/Cache/Backend/Test.php b/library/Zend/Cache/Backend/Test.php deleted file mode 100644 index d3415d0a5..000000000 --- a/library/Zend/Cache/Backend/Test.php +++ /dev/null @@ -1,416 +0,0 @@ -_addLog('construct', [$options]); - } - - /** - * Set the frontend directives. - * - * @param array $directives assoc of directives - */ - public function setDirectives($directives) - { - $this->_addLog('setDirectives', [$directives]); - } - - /** - * Test if a cache is available for the given id and (if yes) return it (false else). - * - * For this test backend only, if $id == 'false', then the method will return false - * if $id == 'serialized', the method will return a serialized array - * ('foo' else) - * - * @param string $id Cache id - * @param bool $doNotTestCacheValidity If set to true, the cache validity won't be tested - * - * @return string Cached datas (or false) - */ - public function load($id, $doNotTestCacheValidity = false) - { - $this->_addLog('get', [$id, $doNotTestCacheValidity]); - - if ($id == 'false' - || $id == 'd8523b3ee441006261eeffa5c3d3a0a7' - || $id == 'e83249ea22178277d5befc2c5e2e9ace' - || $id == '40f649b94977c0a6e76902e2a0b43587' - || $id == '88161989b73a4cbfd0b701c446115a99' - || $id == '205fc79cba24f0f0018eb92c7c8b3ba4' - || $id == '170720e35f38150b811f68a937fb042d') { - return false; - } - if ($id == 'serialized') { - return serialize(['foo']); - } - if ($id == 'serialized2') { - return serialize(['headers' => [], 'data' => 'foo']); - } - if ($id == '71769f39054f75894288e397df04e445' || $id == '615d222619fb20b527168340cebd0578' - || $id == '8a02d218a5165c467e7a5747cc6bd4b6' || $id == '648aca1366211d17cbf48e65dc570bee' - || $id == '4a923ef02d7f997ca14d56dfeae25ea7') { - return serialize(['foo', 'bar']); - } - if ($id == 'f53c7d912cc523d9a65834c8286eceb9') { - return serialize(['foobar']); - } - - return 'foo'; - } - - /** - * Test if a cache is available or not (for the given id). - * - * For this test backend only, if $id == 'false', then the method will return false - * (123456 else) - * - * @param string $id Cache id - * - * @return false|mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record - */ - public function test($id) - { - $this->_addLog('test', [$id]); - if ($id == 'false') { - return false; - } - if (($id == '3c439c922209e2cb0b54d6deffccd75a')) { - return false; - } - - return 123456; - } - - /** - * Save some string datas into a cache record. - * - * For this test backend only, if $id == 'false', then the method will return false - * (true else) - * - * @param string $data Datas to cache - * @param string $id Cache id - * @param array $tags Array of strings, the cache record will be tagged by each string entry - * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) - * - * @return bool True if no problem - */ - public function save($data, $id, $tags = [], $specificLifetime = false) - { - $this->_addLog('save', [$data, $id, $tags]); - if (substr($id,-5) == 'false') { - return false; - } - - return true; - } - - /** - * Remove a cache record. - * - * For this test backend only, if $id == 'false', then the method will return false - * (true else) - * - * @param string $id Cache id - * - * @return bool True if no problem - */ - public function remove($id) - { - $this->_addLog('remove', [$id]); - if (substr($id,-5) == 'false') { - return false; - } - - return true; - } - - /** - * Clean some cache records. - * - * For this test backend only, if $mode == 'false', then the method will return false - * (true else) - * - * Available modes are : - * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) - * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) - * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags - * ($tags can be an array of strings or a single string) - * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} - * ($tags can be an array of strings or a single string) - * - * @param string $mode Clean mode - * @param array $tags Array of tags - * - * @return bool True if no problem - */ - public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = []) - { - $this->_addLog('clean', [$mode, $tags]); - if ($mode == 'false') { - return false; - } - - return true; - } - - /** - * Get the last log. - * - * @return string The last log - */ - public function getLastLog() - { - return $this->_log[$this->_index - 1]; - } - - /** - * Get the log index. - * - * @return int Log index - */ - public function getLogIndex() - { - return $this->_index; - } - - /** - * Get the complete log array. - * - * @return array Complete log array - */ - public function getAllLogs() - { - return $this->_log; - } - - /** - * Return true if the automatic cleaning is available for the backend. - * - * @return bool - */ - public function isAutomaticCleaningAvailable() - { - return true; - } - - /** - * Return an array of stored cache ids. - * - * @return array array of stored cache ids (string) - */ - public function getIds() - { - return [ - 'prefix_id1', 'prefix_id2', - ]; - } - - /** - * Return an array of stored tags. - * - * @return array array of stored tags (string) - */ - public function getTags() - { - return [ - 'tag1', 'tag2', - ]; - } - - /** - * Return an array of stored cache ids which match given tags. - * - * In case of multiple tags, a logical AND is made between tags - * - * @param array $tags array of tags - * - * @return array array of matching cache ids (string) - */ - public function getIdsMatchingTags($tags = []) - { - if ($tags == ['tag1', 'tag2']) { - return ['prefix_id1', 'prefix_id2']; - } - - return []; - } - - /** - * Return an array of stored cache ids which don't match given tags. - * - * In case of multiple tags, a logical OR is made between tags - * - * @param array $tags array of tags - * - * @return array array of not matching cache ids (string) - */ - public function getIdsNotMatchingTags($tags = []) - { - if ($tags == ['tag3', 'tag4']) { - return ['prefix_id3', 'prefix_id4']; - } - - return []; - } - - /** - * Return an array of stored cache ids which match any given tags. - * - * In case of multiple tags, a logical AND is made between tags - * - * @param array $tags array of tags - * - * @return array array of any matching cache ids (string) - */ - public function getIdsMatchingAnyTags($tags = []) - { - if ($tags == ['tag5', 'tag6']) { - return ['prefix_id5', 'prefix_id6']; - } - - return []; - } - - /** - * Return the filling percentage of the backend storage. - * - * @return int integer between 0 and 100 - */ - public function getFillingPercentage() - { - return 50; - } - - /** - * Return an array of metadatas for the given cache id. - * - * The array must include these keys : - * - expire : the expire timestamp - * - tags : a string array of tags - * - mtime : timestamp of last modification time - * - * @param string $id cache id - * - * @return array array of metadatas (false if the cache id is not found) - */ - public function getMetadatas($id) - { - return false; - } - - /** - * Give (if possible) an extra lifetime to the given cache id. - * - * @param string $id cache id - * @param int $extraLifetime - * - * @return bool true if ok - */ - public function touch($id, $extraLifetime) - { - return true; - } - - /** - * Return an associative array of capabilities (booleans) of the backend. - * - * The array must include these keys : - * - automatic_cleaning (is automating cleaning necessary) - * - tags (are tags supported) - * - expired_read (is it possible to read expired cache records - * (for doNotTestCacheValidity option for example)) - * - priority does the backend deal with priority when saving - * - infinite_lifetime (is infinite lifetime can work with this backend) - * - get_list (is it possible to get the list of cache ids and the complete list of tags) - * - * @return array associative of with capabilities - */ - public function getCapabilities() - { - return [ - 'automatic_cleaning' => true, - 'tags' => true, - 'expired_read' => false, - 'priority' => true, - 'infinite_lifetime' => true, - 'get_list' => true, - ]; - } - - /** - * Add an event to the log array. - * - * @param string $methodName MethodName - * @param array $args Arguments - */ - private function _addLog($methodName, $args) - { - $this->_log[$this->_index] = [ - 'methodName' => $methodName, - 'args' => $args, - ]; - $this->_index = $this->_index + 1; - } -} diff --git a/library/Zend/Cache/Core.php b/library/Zend/Cache/Core.php deleted file mode 100644 index 492da807e..000000000 --- a/library/Zend/Cache/Core.php +++ /dev/null @@ -1,727 +0,0 @@ - (boolean) write_control : - * - Enable / disable write control (the cache is read just after writing to detect corrupt entries) - * - Enable write control will lightly slow the cache writing but not the cache reading - * Write control can detect some corrupt cache files but maybe it's not a perfect control - * - * ====> (boolean) caching : - * - Enable / disable caching - * (can be very useful for the debug of cached scripts) - * - * =====> (string) cache_id_prefix : - * - prefix for cache ids (namespace) - * - * ====> (boolean) automatic_serialization : - * - Enable / disable automatic serialization - * - It can be used to save directly datas which aren't strings (but it's slower) - * - * ====> (int) automatic_cleaning_factor : - * - Disable / Tune the automatic cleaning process - * - The automatic cleaning process destroy too old (for the given life time) - * cache files when a new cache file is written : - * 0 => no automatic cache cleaning - * 1 => systematic cache cleaning - * x (integer) > 1 => automatic cleaning randomly 1 times on x cache write - * - * ====> (int) lifetime : - * - Cache lifetime (in seconds) - * - If null, the cache is valid forever. - * - * ====> (boolean) logging : - * - If set to true, logging is activated (but the system is slower) - * - * ====> (boolean) ignore_user_abort - * - If set to true, the core will set the ignore_user_abort PHP flag inside the - * save() method to avoid cache corruptions in some cases (default false) - * - * @var array available options - */ - protected $_options = [ - 'write_control' => true, - 'caching' => true, - 'cache_id_prefix' => null, - 'automatic_serialization' => false, - 'automatic_cleaning_factor' => 10, - 'lifetime' => 3600, - 'logging' => false, - 'logger' => null, - 'ignore_user_abort' => false, - ]; - - /** - * Array of options which have to be transfered to backend. - * - * @var array - */ - protected static $_directivesList = ['lifetime', 'logging', 'logger']; - - /** - * Not used for the core, just a sort a hint to get a common setOption() method (for the core and for frontends). - * - * @var array - */ - protected $_specificOptions = []; - - /** - * Last used cache id. - */ - private ?string $_lastId = null; - - /** - * True if the backend implements Zend_Cache_Backend_ExtendedInterface. - * - * @var bool - */ - protected $_extendedBackend = false; - - /** - * Array of capabilities of the backend (only if it implements Zend_Cache_Backend_ExtendedInterface). - * - * @var array - */ - protected $_backendCapabilities = []; - - /** - * Constructor. - * - * @param array|Zend_Config $options Associative array of options or Zend_Config instance - */ - public function __construct($options = []) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - if (!is_array($options)) { - Zend_Cache::throwException('Options passed were not an array' - . ' or Zend_Config instance.'); - } - foreach ($options as $name => $value) { - $this->setOption($name, $value); - } - } - - /** - * Set options using an instance of type Zend_Config. - * - * @return Zend_Cache_Core - */ - public function setConfig(Zend_Config $config) - { - $options = $config->toArray(); - foreach ($options as $name => $value) { - $this->setOption($name, $value); - } - - return $this; - } - - /** - * Set the backend. - */ - public function setBackend(Zend_Cache_Backend $backendObject) - { - $this->_backend = $backendObject; - // some options (listed in $_directivesList) have to be given - // to the backend too (even if they are not "backend specific") - $directives = []; - foreach (Zend_Cache_Core::$_directivesList as $directive) { - $directives[$directive] = $this->_options[$directive]; - } - $this->_backend->setDirectives($directives); - if (in_array(\Zend_Cache_Backend_ExtendedInterface::class, class_implements($this->_backend))) { - $this->_extendedBackend = true; - $this->_backendCapabilities = $this->_backend->getCapabilities(); - } - } - - /** - * Returns the backend. - * - * @return Zend_Cache_Backend backend object - */ - public function getBackend() - { - return $this->_backend; - } - - /** - * Public frontend to set an option. - * - * There is an additional validation (relatively to the protected _setOption method) - * - * @param string $name Name of the option - * @param mixed $value Value of the option - */ - public function setOption($name, $value) - { - if (!is_string($name)) { - Zend_Cache::throwException('Incorrect option name!'); - } - $name = strtolower($name); - if (array_key_exists($name, $this->_options)) { - // This is a Core option - $this->_setOption($name, $value); - - return; - } - if (array_key_exists($name, $this->_specificOptions)) { - // This a specic option of this frontend - $this->_specificOptions[$name] = $value; - - return; - } - } - - /** - * Public frontend to get an option value. - * - * @param string $name Name of the option - * - * @return mixed option value - */ - public function getOption($name) - { - $name = strtolower($name); - - if (array_key_exists($name, $this->_options)) { - // This is a Core option - return $this->_options[$name]; - } - - if (array_key_exists($name, $this->_specificOptions)) { - // This a specic option of this frontend - return $this->_specificOptions[$name]; - } - - Zend_Cache::throwException("Incorrect option name : $name"); - } - - /** - * Set an option. - * - * @param string $name Name of the option - * @param mixed $value Value of the option - */ - private function _setOption($name, $value) - { - if (!is_string($name) || !array_key_exists($name, $this->_options)) { - Zend_Cache::throwException("Incorrect option name : $name"); - } - if ($name == 'lifetime' && empty($value)) { - $value = null; - } - $this->_options[$name] = $value; - } - - /** - * Force a new lifetime. - * - * The new value is set for the core/frontend but for the backend too (directive) - * - * @param int $newLifetime New lifetime (in seconds) - */ - public function setLifetime($newLifetime) - { - $this->_options['lifetime'] = $newLifetime; - $this->_backend->setDirectives([ - 'lifetime' => $newLifetime, - ]); - } - - /** - * Test if a cache is available for the given id and (if yes) return it (false else). - * - * @param string $id Cache id - * @param bool $doNotTestCacheValidity If set to true, the cache validity won't be tested - * @param bool $doNotUnserialize Do not serialize (even if automatic_serialization is true) => for internal use - * - * @return false|mixed Cached datas - */ - public function load($id, $doNotTestCacheValidity = false, $doNotUnserialize = false) - { - if (!$this->_options['caching']) { - return false; - } - $id = $this->_id($id); // cache id may need prefix - $this->_lastId = $id; - $this->_validateIdOrTag($id); - - $this->_log("Zend_Cache_Core: load item '{$id}'", 7); - $data = $this->_backend->load($id, $doNotTestCacheValidity); - if ($data === false) { - // no cache available - return false; - } - if ((!$doNotUnserialize) && $this->_options['automatic_serialization']) { - // we need to unserialize before sending the result - return unserialize($data); - } - - return $data; - } - - /** - * Test if a cache is available for the given id. - * - * @param string $id Cache id - * - * @return false|int Last modified time of cache entry if it is available, false otherwise - */ - public function test($id) - { - if (!$this->_options['caching']) { - return false; - } - $id = $this->_id($id); // cache id may need prefix - $this->_validateIdOrTag($id); - $this->_lastId = $id; - - $this->_log("Zend_Cache_Core: test item '{$id}'", 7); - - return $this->_backend->test($id); - } - - /** - * Save some data in a cache. - * - * @param mixed $data Data to put in cache (can be another type than string if automatic_serialization is on) - * @param string $id Cache id (if not set, the last cache id will be used) - * @param array $tags Cache tags - * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) - * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends - * - * @return bool True if no problem - */ - public function save($data, $id = null, $tags = [], $specificLifetime = false, $priority = 8) - { - $abort = null; - if (!$this->_options['caching']) { - return true; - } - if ($id === null) { - $id = $this->_lastId; - } else { - $id = $this->_id($id); - } - $this->_validateIdOrTag($id); - $this->_validateTagsArray($tags); - if ($this->_options['automatic_serialization']) { - // we need to serialize datas before storing them - $data = serialize($data); - } else { - if (!is_string($data)) { - Zend_Cache::throwException('Datas must be string or set automatic_serialization = true'); - } - } - - // automatic cleaning - if ($this->_options['automatic_cleaning_factor'] > 0) { - $rand = random_int(1, $this->_options['automatic_cleaning_factor']); - if ($rand == 1) { - // new way || deprecated way - if ($this->_extendedBackend || method_exists($this->_backend, 'isAutomaticCleaningAvailable')) { - $this->_log('Zend_Cache_Core::save(): automatic cleaning running', 7); - $this->clean(Zend_Cache::CLEANING_MODE_OLD); - } else { - $this->_log('Zend_Cache_Core::save(): automatic cleaning is not available/necessary with current backend', 4); - } - } - } - - $this->_log("Zend_Cache_Core: save item '{$id}'", 7); - if ($this->_options['ignore_user_abort']) { - $abort = ignore_user_abort(true); - } - if (($this->_extendedBackend) && ($this->_backendCapabilities['priority'])) { - $result = $this->_backend->save($data, $id, $tags, $specificLifetime, $priority); - } else { - $result = $this->_backend->save($data, $id, $tags, $specificLifetime); - } - if ($this->_options['ignore_user_abort']) { - ignore_user_abort($abort); - } - - if (!$result) { - // maybe the cache is corrupted, so we remove it ! - $this->_log("Zend_Cache_Core::save(): failed to save item '{$id}' -> removing it", 4); - $this->_backend->remove($id); - - return false; - } - - if ($this->_options['write_control']) { - $data2 = $this->_backend->load($id, true); - if ($data != $data2) { - $this->_log("Zend_Cache_Core::save(): write control of item '{$id}' failed -> removing it", 4); - $this->_backend->remove($id); - - return false; - } - } - - return true; - } - - /** - * Remove a cache. - * - * @param string $id Cache id to remove - * - * @return bool True if ok - */ - public function remove($id) - { - if (!$this->_options['caching']) { - return true; - } - $id = $this->_id($id); // cache id may need prefix - $this->_validateIdOrTag($id); - - $this->_log("Zend_Cache_Core: remove item '{$id}'", 7); - - return $this->_backend->remove($id); - } - - /** - * Clean cache entries. - * - * Available modes are : - * 'all' (default) => remove all cache entries ($tags is not used) - * 'old' => remove too old cache entries ($tags is not used) - * 'matchingTag' => remove cache entries matching all given tags - * ($tags can be an array of strings or a single string) - * 'notMatchingTag' => remove cache entries not matching one of the given tags - * ($tags can be an array of strings or a single string) - * 'matchingAnyTag' => remove cache entries matching any given tags - * ($tags can be an array of strings or a single string) - * - * @param string $mode - * @param array|string $tags - * - * @return bool True if ok - */ - public function clean($mode = 'all', $tags = []) - { - if (!$this->_options['caching']) { - return true; - } - if (!in_array($mode, [Zend_Cache::CLEANING_MODE_ALL, - Zend_Cache::CLEANING_MODE_OLD, - Zend_Cache::CLEANING_MODE_MATCHING_TAG, - Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG, - Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, ])) { - Zend_Cache::throwException('Invalid cleaning mode'); - } - $this->_validateTagsArray($tags); - - return $this->_backend->clean($mode, $tags); - } - - /** - * Return an array of stored cache ids which match given tags. - * - * In case of multiple tags, a logical AND is made between tags - * - * @param array $tags array of tags - * - * @return array array of matching cache ids (string) - */ - public function getIdsMatchingTags($tags = []) - { - if (!$this->_extendedBackend) { - Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); - } - if (!($this->_backendCapabilities['tags'])) { - Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG); - } - - $ids = $this->_backend->getIdsMatchingTags($tags); - - // we need to remove cache_id_prefix from ids (see #ZF-6178, #ZF-7600) - if (isset($this->_options['cache_id_prefix']) && $this->_options['cache_id_prefix'] !== '') { - $prefix = &$this->_options['cache_id_prefix']; - $prefixLen = strlen($prefix); - foreach ($ids as &$id) { - if (strpos($id, (string) $prefix) === 0) { - $id = substr($id, $prefixLen); - } - } - } - - return $ids; - } - - /** - * Return an array of stored cache ids which don't match given tags. - * - * In case of multiple tags, a logical OR is made between tags - * - * @param array $tags array of tags - * - * @return array array of not matching cache ids (string) - */ - public function getIdsNotMatchingTags($tags = []) - { - if (!$this->_extendedBackend) { - Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); - } - if (!($this->_backendCapabilities['tags'])) { - Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG); - } - - $ids = $this->_backend->getIdsNotMatchingTags($tags); - - // we need to remove cache_id_prefix from ids (see #ZF-6178, #ZF-7600) - if (isset($this->_options['cache_id_prefix']) && $this->_options['cache_id_prefix'] !== '') { - $prefix = &$this->_options['cache_id_prefix']; - $prefixLen = strlen($prefix); - foreach ($ids as &$id) { - if (strpos($id, (string) $prefix) === 0) { - $id = substr($id, $prefixLen); - } - } - } - - return $ids; - } - - /** - * Return an array of stored cache ids which match any given tags. - * - * In case of multiple tags, a logical OR is made between tags - * - * @param array $tags array of tags - * - * @return array array of matching any cache ids (string) - */ - public function getIdsMatchingAnyTags($tags = []) - { - if (!$this->_extendedBackend) { - Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); - } - if (!($this->_backendCapabilities['tags'])) { - Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG); - } - - $ids = $this->_backend->getIdsMatchingAnyTags($tags); - - // we need to remove cache_id_prefix from ids (see #ZF-6178, #ZF-7600) - if (isset($this->_options['cache_id_prefix']) && $this->_options['cache_id_prefix'] !== '') { - $prefix = &$this->_options['cache_id_prefix']; - $prefixLen = strlen($prefix); - foreach ($ids as &$id) { - if (strpos($id, (string) $prefix) === 0) { - $id = substr($id, $prefixLen); - } - } - } - - return $ids; - } - - /** - * Return an array of stored cache ids. - * - * @return array array of stored cache ids (string) - */ - public function getIds() - { - if (!$this->_extendedBackend) { - Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); - } - - $ids = $this->_backend->getIds(); - - // we need to remove cache_id_prefix from ids (see #ZF-6178, #ZF-7600) - if (isset($this->_options['cache_id_prefix']) && $this->_options['cache_id_prefix'] !== '') { - $prefix = &$this->_options['cache_id_prefix']; - $prefixLen = strlen($prefix); - foreach ($ids as &$id) { - if (strpos($id, (string) $prefix) === 0) { - $id = substr($id, $prefixLen); - } - } - } - - return $ids; - } - - /** - * Return an array of stored tags. - * - * @return array array of stored tags (string) - */ - public function getTags() - { - if (!$this->_extendedBackend) { - Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); - } - if (!($this->_backendCapabilities['tags'])) { - Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG); - } - - return $this->_backend->getTags(); - } - - /** - * Return the filling percentage of the backend storage. - * - * @return int integer between 0 and 100 - */ - public function getFillingPercentage() - { - if (!$this->_extendedBackend) { - Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); - } - - return $this->_backend->getFillingPercentage(); - } - - /** - * Return an array of metadatas for the given cache id. - * - * The array will include these keys : - * - expire : the expire timestamp - * - tags : a string array of tags - * - mtime : timestamp of last modification time - * - * @param string $id cache id - * - * @return array array of metadatas (false if the cache id is not found) - */ - public function getMetadatas($id) - { - if (!$this->_extendedBackend) { - Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); - } - $id = $this->_id($id); // cache id may need prefix - - return $this->_backend->getMetadatas($id); - } - - /** - * Give (if possible) an extra lifetime to the given cache id. - * - * @param string $id cache id - * @param int $extraLifetime - * - * @return bool true if ok - */ - public function touch($id, $extraLifetime) - { - if (!$this->_extendedBackend) { - Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); - } - $id = $this->_id($id); // cache id may need prefix - - $this->_log("Zend_Cache_Core: touch item '{$id}'", 7); - - return $this->_backend->touch($id, $extraLifetime); - } - - /** - * Validate a cache id or a tag (security, reliable filenames, reserved prefixes...). - * - * Throw an exception if a problem is found - * - * @param string $string Cache id or tag - */ - protected function _validateIdOrTag($string) - { - if (!is_string($string)) { - Zend_Cache::throwException('Invalid id or tag : must be a string'); - } - if (substr($string, 0, 9) == 'internal-') { - Zend_Cache::throwException('"internal-*" ids or tags are reserved'); - } - if (!preg_match('~^[a-zA-Z0-9_]+$~D', $string)) { - Zend_Cache::throwException("Invalid id or tag '$string' : must use only [a-zA-Z0-9_]"); - } - } - - /** - * Validate a tags array (security, reliable filenames, reserved prefixes...). - * - * Throw an exception if a problem is found - * - * @param array $tags Array of tags - */ - protected function _validateTagsArray($tags) - { - if (!is_array($tags)) { - Zend_Cache::throwException('Invalid tags array : must be an array'); - } - foreach ($tags as $tag) { - $this->_validateIdOrTag($tag); - } - reset($tags); - } - - /** - * Log a message at the WARN (4) priority. - * - * @param string $message - * @param mixed $priority - */ - protected function _log($message, $priority = 4) - { - } - - /** - * Make and return a cache id. - * - * Checks 'cache_id_prefix' and returns new id with prefix or simply the id if null - * - * @param string $id Cache id - * - * @return string Cache id (with or without prefix) - */ - protected function _id($id) - { - if (($id !== null) && isset($this->_options['cache_id_prefix'])) { - return $this->_options['cache_id_prefix'] . $id; // return with prefix - } - - return $id; // no prefix, just return the $id passed - } -} diff --git a/library/Zend/Cache/Exception.php b/library/Zend/Cache/Exception.php deleted file mode 100644 index 67f021ae4..000000000 --- a/library/Zend/Cache/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ -_tags = $tags; - $this->_extension = $extension; - ob_start([$this, '_flush']); - ob_implicit_flush(false); - $this->_idStack[] = $id; - - return false; - } - - /** - * callback for output buffering - * (shouldn't really be called manually). - * - * @param string $data Buffered output - * - * @return string Data to send to browser - */ - public function _flush($data) - { - $id = array_pop($this->_idStack); - if ($id === null) { - Zend_Cache::throwException('use of _flush() without a start()'); - } - if ($this->_extension) { - $this->save(serialize([$data, $this->_extension]), $id, $this->_tags); - } else { - $this->save($data, $id, $this->_tags); - } - - return $data; - } -} diff --git a/library/Zend/Cache/Frontend/Class.php b/library/Zend/Cache/Frontend/Class.php deleted file mode 100644 index cb11e1281..000000000 --- a/library/Zend/Cache/Frontend/Class.php +++ /dev/null @@ -1,270 +0,0 @@ - (mixed) cached_entity : - * - if set to a class name, we will cache an abstract class and will use only static calls - * - if set to an object, we will cache this object methods - * - * ====> (boolean) cache_by_default : - * - if true, method calls will be cached by default - * - * ====> (array) cached_methods : - * - an array of method names which will be cached (even if cache_by_default = false) - * - * ====> (array) non_cached_methods : - * - an array of method names which won't be cached (even if cache_by_default = true) - * - * @var array available options - */ - protected $_specificOptions = [ - 'cached_entity' => null, - 'cache_by_default' => true, - 'cached_methods' => [], - 'non_cached_methods' => [], - ]; - - /** - * Tags array. - * - * @var array - */ - protected $_tags = []; - - /** - * SpecificLifetime value. - * - * false => no specific life time - * - * @var bool|int - */ - protected $_specificLifetime = false; - - /** - * The cached object or the name of the cached abstract class. - * - * @var mixed - */ - protected $_cachedEntity; - - /** - * The class name of the cached object or cached abstract class. - * - * Used to differentiate between different classes with the same method calls. - * - * @var string - */ - protected $_cachedEntityLabel = ''; - - /** - * Priority (used by some particular backends). - * - * @var int - */ - protected $_priority = 8; - - /** - * Constructor. - * - * @param array $options Associative array of options - */ - public function __construct(array $options = []) - { - foreach ($options as $name => $value) { - $this->setOption($name, $value); - } - if ($this->_specificOptions['cached_entity'] === null) { - Zend_Cache::throwException('cached_entity must be set !'); - } - $this->setCachedEntity($this->_specificOptions['cached_entity']); - $this->setOption('automatic_serialization', true); - } - - /** - * Set a specific life time. - * - * @param bool|int $specificLifetime - */ - public function setSpecificLifetime($specificLifetime = false) - { - $this->_specificLifetime = $specificLifetime; - } - - /** - * Set the priority (used by some particular backends). - * - * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) - */ - public function setPriority($priority) - { - $this->_priority = $priority; - } - - /** - * Public frontend to set an option. - * - * Just a wrapper to get a specific behaviour for cached_entity - * - * @param string $name Name of the option - * @param mixed $value Value of the option - */ - public function setOption($name, $value) - { - if ($name == 'cached_entity') { - $this->setCachedEntity($value); - } else { - parent::setOption($name, $value); - } - } - - /** - * Specific method to set the cachedEntity. - * - * if set to a class name, we will cache an abstract class and will use only static calls - * if set to an object, we will cache this object methods - * - * @param mixed $cachedEntity - */ - public function setCachedEntity($cachedEntity) - { - if (!is_string($cachedEntity) && !is_object($cachedEntity)) { - Zend_Cache::throwException( - 'cached_entity must be an object or a class name' - ); - } - - $this->_cachedEntity = $cachedEntity; - $this->_specificOptions['cached_entity'] = $cachedEntity; - - if (is_string($this->_cachedEntity)) { - $this->_cachedEntityLabel = $this->_cachedEntity; - } else { - $ro = new ReflectionObject($this->_cachedEntity); - $this->_cachedEntityLabel = $ro->getName(); - } - } - - /** - * Set the cache array. - * - * @param array $tags - */ - public function setTagsArray($tags = []) - { - $this->_tags = $tags; - } - - /** - * Main method : call the specified method or get the result from cache. - * - * @param string $name Method name - * @param array $parameters Method parameters - * - * @return mixed Result - */ - public function __call($name, $parameters) - { - $callback = [$this->_cachedEntity, $name]; - - if (!is_callable($callback, false)) { - Zend_Cache::throwException('Invalid callback'); - } - - $cacheBool1 = $this->_specificOptions['cache_by_default']; - $cacheBool2 = in_array($name, $this->_specificOptions['cached_methods']); - $cacheBool3 = in_array($name, $this->_specificOptions['non_cached_methods']); - $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3)); - - if (!$cache) { - // We do not have not cache - return call_user_func_array($callback, $parameters); - } - - $id = $this->makeId($name, $parameters); - if (($rs = $this->load($id)) && (array_key_exists(0, $rs)) - && (array_key_exists(1, $rs)) - ) { - // A cache is available - $output = $rs[0]; - $return = $rs[1]; - } else { - // A cache is not available (or not valid for this frontend) - ob_start(); - ob_implicit_flush(false); - - try { - $return = call_user_func_array($callback, $parameters); - $output = ob_get_clean(); - $data = [$output, $return]; - - $this->save( - $data, $id, $this->_tags, $this->_specificLifetime, - $this->_priority - ); - } catch (Exception $e) { - ob_end_clean(); - - throw $e; - } - } - - echo $output; - - return $return; - } - - /** - * ZF-9970. - * - * @deprecated - * - * @param mixed $name - * @param mixed $args - */ - private function _makeId($name, $args) - { - return $this->makeId($name, $args); - } - - /** - * Make a cache id from the method name and parameters. - * - * @param string $name Method name - * @param array $args Method parameters - * - * @return string Cache id - */ - public function makeId($name, array $args = []) - { - return md5($this->_cachedEntityLabel . '__' . $name . '__' . serialize($args)); - } -} diff --git a/library/Zend/Cache/Frontend/File.php b/library/Zend/Cache/Frontend/File.php deleted file mode 100644 index a6f4d8e6b..000000000 --- a/library/Zend/Cache/Frontend/File.php +++ /dev/null @@ -1,214 +0,0 @@ - (string) master_file : - * - a complete path of the master file - * - deprecated (see master_files) - * - * ====> (array) master_files : - * - an array of complete path of master files - * - this option has to be set ! - * - * ====> (string) master_files_mode : - * - Zend_Cache_Frontend_File::MODE_AND or Zend_Cache_Frontend_File::MODE_OR - * - if MODE_AND, then all master files have to be touched to get a cache invalidation - * - if MODE_OR (default), then a single touched master file is enough to get a cache invalidation - * - * ====> (boolean) ignore_missing_master_files - * - if set to true, missing master files are ignored silently - * - if set to false (default), an exception is thrown if there is a missing master file - * - * @var array available options - */ - protected $_specificOptions = [ - 'master_file' => null, - 'master_files' => null, - 'master_files_mode' => 'OR', - 'ignore_missing_master_files' => false, - ]; - - /** - * Master file mtimes. - * - * Array of int - */ - private ?array $_masterFile_mtimes = null; - - /** - * Constructor. - * - * @param array $options Associative array of options - */ - public function __construct(array $options = []) - { - foreach ($options as $name => $value) { - $this->setOption($name, $value); - } - if (!isset($this->_specificOptions['master_files'])) { - Zend_Cache::throwException('master_files option must be set'); - } - } - - /** - * Change the master_files option. - * - * @param array $masterFiles the complete paths and name of the master files - */ - public function setMasterFiles(array $masterFiles) - { - $this->_specificOptions['master_file'] = null; // to keep a compatibility - $this->_specificOptions['master_files'] = null; - $this->_masterFile_mtimes = []; - - clearstatcache(); - $i = 0; - foreach ($masterFiles as $masterFile) { - if (file_exists($masterFile)) { - $mtime = filemtime($masterFile); - } else { - $mtime = false; - } - - if (!$this->_specificOptions['ignore_missing_master_files'] && !$mtime) { - Zend_Cache::throwException('Unable to read master_file : ' . $masterFile); - } - - $this->_masterFile_mtimes[$i] = $mtime; - $this->_specificOptions['master_files'][$i] = $masterFile; - if ($i === 0) { // to keep a compatibility - $this->_specificOptions['master_file'] = $masterFile; - } - - ++$i; - } - } - - /** - * Change the master_file option. - * - * To keep the compatibility - * - * @deprecated - * - * @param string $masterFile the complete path and name of the master file - */ - public function setMasterFile($masterFile) - { - $this->setMasterFiles([$masterFile]); - } - - /** - * Public frontend to set an option. - * - * Just a wrapper to get a specific behaviour for master_file - * - * @param string $name Name of the option - * @param mixed $value Value of the option - */ - public function setOption($name, $value) - { - if ($name == 'master_file') { - $this->setMasterFile($value); - } elseif ($name == 'master_files') { - $this->setMasterFiles($value); - } else { - parent::setOption($name, $value); - } - } - - /** - * Test if a cache is available for the given id and (if yes) return it (false else). - * - * @param string $id Cache id - * @param bool $doNotTestCacheValidity If set to true, the cache validity won't be tested - * @param bool $doNotUnserialize Do not serialize (even if automatic_serialization is true) => for internal use - * - * @return false|mixed Cached datas - */ - public function load($id, $doNotTestCacheValidity = false, $doNotUnserialize = false) - { - if (!$doNotTestCacheValidity) { - if ($this->test($id)) { - return parent::load($id, true, $doNotUnserialize); - } - - return false; - } - - return parent::load($id, true, $doNotUnserialize); - } - - /** - * Test if a cache is available for the given id. - * - * @param string $id Cache id - * - * @return false|int Last modified time of cache entry if it is available, false otherwise - */ - public function test($id) - { - $lastModified = parent::test($id); - if ($lastModified) { - if ($this->_specificOptions['master_files_mode'] == self::MODE_AND) { - // MODE_AND - foreach ($this->_masterFile_mtimes as $masterFileMTime) { - if ($masterFileMTime) { - if ($lastModified > $masterFileMTime) { - return $lastModified; - } - } - } - } else { - // MODE_OR - $res = true; - foreach ($this->_masterFile_mtimes as $masterFileMTime) { - if ($masterFileMTime) { - if ($lastModified <= $masterFileMTime) { - return false; - } - } - } - - return $lastModified; - } - } - - return false; - } -} diff --git a/library/Zend/Cache/Frontend/Function.php b/library/Zend/Cache/Frontend/Function.php deleted file mode 100644 index c93b461f8..000000000 --- a/library/Zend/Cache/Frontend/Function.php +++ /dev/null @@ -1,176 +0,0 @@ - (boolean) cache_by_default : - * - if true, function calls will be cached by default - * - * ====> (array) cached_functions : - * - an array of function names which will be cached (even if cache_by_default = false) - * - * ====> (array) non_cached_functions : - * - an array of function names which won't be cached (even if cache_by_default = true) - * - * @var array options - */ - protected $_specificOptions = [ - 'cache_by_default' => true, - 'cached_functions' => [], - 'non_cached_functions' => [], - ]; - - /** - * Constructor. - * - * @param array $options Associative array of options - */ - public function __construct(array $options = []) - { - foreach ($options as $name => $value) { - $this->setOption($name, $value); - } - $this->setOption('automatic_serialization', true); - } - - /** - * Main method : call the specified function or get the result from cache. - * - * @param callable $callback A valid callback - * @param array $parameters Function parameters - * @param array $tags Cache tags - * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) - * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends - * - * @return mixed Result - */ - public function call($callback, array $parameters = [], $tags = [], $specificLifetime = false, $priority = 8) - { - if (!is_callable($callback, true, $name)) { - Zend_Cache::throwException('Invalid callback'); - } - - $cacheBool1 = $this->_specificOptions['cache_by_default']; - $cacheBool2 = in_array($name, $this->_specificOptions['cached_functions']); - $cacheBool3 = in_array($name, $this->_specificOptions['non_cached_functions']); - $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3)); - if (!$cache) { - // Caching of this callback is disabled - return call_user_func_array($callback, $parameters); - } - - $id = $this->_makeId($callback, $parameters); - if (($rs = $this->load($id)) && isset($rs[0], $rs[1])) { - // A cache is available - $output = $rs[0]; - $return = $rs[1]; - } else { - // A cache is not available (or not valid for this frontend) - ob_start(); - ob_implicit_flush(false); - $return = call_user_func_array($callback, $parameters); - $output = ob_get_clean(); - $data = [$output, $return]; - $this->save($data, $id, $tags, $specificLifetime, $priority); - } - - echo $output; - - return $return; - } - - /** - * ZF-9970. - * - * @deprecated - * - * @param mixed $callback - */ - private function _makeId($callback, array $args) - { - return $this->makeId($callback, $args); - } - - /** - * Make a cache id from the function name and parameters. - * - * @param callable $callback A valid callback - * @param array $args Function parameters - * - * @return string Cache id - */ - public function makeId($callback, array $args = []) - { - $tmp = null; - if (!is_callable($callback, true, $name)) { - Zend_Cache::throwException('Invalid callback'); - } - - // functions, methods and classnames are case-insensitive - $name = strtolower($name); - - // generate a unique id for object callbacks - if (is_object($callback)) { // Closures & __invoke - $object = $callback; - } elseif (isset($callback[0])) { // array($object, 'method') - $object = $callback[0]; - } - if (isset($object)) { - try { - $tmp = @serialize($callback); - } catch (Exception $e) { - Zend_Cache::throwException($e->getMessage()); - } - if (!$tmp) { - $lastErr = error_get_last(); - Zend_Cache::throwException("Can't serialize callback object to generate id: {$lastErr['message']}"); - } - $name .= '__' . $tmp; - } - - // generate a unique id for arguments - $argsStr = ''; - if ($args) { - try { - $argsStr = @serialize(array_values($args)); - } catch (Exception $e) { - Zend_Cache::throwException($e->getMessage()); - } - if (!$argsStr) { - $lastErr = error_get_last(); - - throw Zend_Cache::throwException("Can't serialize arguments to generate id: {$lastErr['message']}"); - } - } - - return md5($name . $argsStr); - } -} diff --git a/library/Zend/Cache/Frontend/Output.php b/library/Zend/Cache/Frontend/Output.php deleted file mode 100644 index f81581bb1..000000000 --- a/library/Zend/Cache/Frontend/Output.php +++ /dev/null @@ -1,97 +0,0 @@ -_idStack = []; - } - - /** - * Start the cache. - * - * @param string $id Cache id - * @param bool $doNotTestCacheValidity If set to true, the cache validity won't be tested - * @param bool $echoData If set to true, datas are sent to the browser if the cache is hit (simply returned else) - * - * @return mixed True if the cache is hit (false else) with $echoData=true (default) ; string else (datas) - */ - public function start($id, $doNotTestCacheValidity = false, $echoData = true) - { - $data = $this->load($id, $doNotTestCacheValidity); - if ($data !== false) { - if ($echoData) { - echo $data; - - return true; - } - - return $data; - } - ob_start(); - ob_implicit_flush(false); - $this->_idStack[] = $id; - - return false; - } - - /** - * Stop the cache. - * - * @param array $tags Tags array - * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) - * @param string $forcedDatas If not null, force written datas with this - * @param bool $echoData If set to true, datas are sent to the browser - * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends - */ - public function end($tags = [], $specificLifetime = false, $forcedDatas = null, $echoData = true, $priority = 8) - { - if ($forcedDatas === null) { - $data = ob_get_clean(); - } else { - $data = &$forcedDatas; - } - $id = array_pop($this->_idStack); - if ($id === null) { - Zend_Cache::throwException('use of end() without a start()'); - } - $this->save($data, $id, $tags, $specificLifetime, $priority); - if ($echoData) { - echo $data; - } - } -} diff --git a/library/Zend/Cache/Frontend/Page.php b/library/Zend/Cache/Frontend/Page.php deleted file mode 100644 index 6d3584c3c..000000000 --- a/library/Zend/Cache/Frontend/Page.php +++ /dev/null @@ -1,405 +0,0 @@ - (boolean) http_conditional : - * - if true, http conditional mode is on - * WARNING : http_conditional OPTION IS NOT IMPLEMENTED FOR THE MOMENT (TODO) - * - * ====> (boolean) debug_header : - * - if true, a debug text is added before each cached pages - * - * ====> (boolean) content_type_memorization : - * - deprecated => use memorize_headers instead - * - if the Content-Type header is sent after the cache was started, the - * corresponding value can be memorized and replayed when the cache is hit - * (if false (default), the frontend doesn't take care of Content-Type header) - * - * ====> (array) memorize_headers : - * - an array of strings corresponding to some HTTP headers name. Listed headers - * will be stored with cache datas and "replayed" when the cache is hit - * - * ====> (array) default_options : - * - an associative array of default options : - * - (boolean) cache : cache is on by default if true - * - (boolean) cacheWithXXXVariables (XXXX = 'Get', 'Post', 'Session', 'Files' or 'Cookie') : - * if true, cache is still on even if there are some variables in this superglobal array - * if false, cache is off if there are some variables in this superglobal array - * - (boolean) makeIdWithXXXVariables (XXXX = 'Get', 'Post', 'Session', 'Files' or 'Cookie') : - * if true, we have to use the content of this superglobal array to make a cache id - * if false, the cache id won't be dependent of the content of this superglobal array - * - (int) specific_lifetime : cache specific lifetime - * (false => global lifetime is used, null => infinite lifetime, - * integer => this lifetime is used), this "lifetime" is probably only - * usefull when used with "regexps" array - * - (array) tags : array of tags (strings) - * - (int) priority : integer between 0 (very low priority) and 10 (maximum priority) used by - * some particular backends - * - * ====> (array) regexps : - * - an associative array to set options only for some REQUEST_URI - * - keys are (pcre) regexps - * - values are associative array with specific options to set if the regexp matchs on $_SERVER['REQUEST_URI'] - * (see default_options for the list of available options) - * - if several regexps match the $_SERVER['REQUEST_URI'], only the last one will be used - * - * @var array options - */ - protected $_specificOptions = [ - 'http_conditional' => false, - 'debug_header' => false, - 'content_type_memorization' => false, - 'memorize_headers' => [], - 'default_options' => [ - 'cache_with_get_variables' => false, - 'cache_with_post_variables' => false, - 'cache_with_session_variables' => false, - 'cache_with_files_variables' => false, - 'cache_with_cookie_variables' => false, - 'make_id_with_get_variables' => true, - 'make_id_with_post_variables' => true, - 'make_id_with_session_variables' => true, - 'make_id_with_files_variables' => true, - 'make_id_with_cookie_variables' => true, - 'cache' => true, - 'specific_lifetime' => false, - 'tags' => [], - 'priority' => null, - ], - 'regexps' => [], - ]; - - /** - * Internal array to store some options. - * - * @var array associative array of options - */ - protected $_activeOptions = []; - - /** - * If true, the page won't be cached. - * - * @var bool - */ - protected $_cancel = false; - - /** - * Constructor. - * - * @param array $options Associative array of options - */ - public function __construct(array $options = []) - { - foreach ($options as $name => $value) { - $name = strtolower($name); - switch ($name) { - case 'regexps': - $this->_setRegexps($value); - - break; - case 'default_options': - $this->_setDefaultOptions($value); - - break; - case 'content_type_memorization': - $this->_setContentTypeMemorization($value); - - break; - default: - $this->setOption($name, $value); - } - } - if (isset($this->_specificOptions['http_conditional'])) { - if ($this->_specificOptions['http_conditional']) { - Zend_Cache::throwException('http_conditional is not implemented for the moment !'); - } - } - $this->setOption('automatic_serialization', true); - } - - /** - * Specific setter for the 'default_options' option (with some additional tests). - * - * @param array $options Associative array - */ - protected function _setDefaultOptions($options) - { - if (!is_array($options)) { - Zend_Cache::throwException('default_options must be an array !'); - } - foreach ($options as $key => $value) { - if (!is_string($key)) { - Zend_Cache::throwException("invalid option [$key] !"); - } - $key = strtolower($key); - if (isset($this->_specificOptions['default_options'][$key])) { - $this->_specificOptions['default_options'][$key] = $value; - } - } - } - - /** - * Set the deprecated contentTypeMemorization option. - * - * @param bool $value value - * - * @deprecated - */ - protected function _setContentTypeMemorization($value) - { - $found = null; - foreach ($this->_specificOptions['memorize_headers'] as $key => $value) { - if (strtolower($value) == 'content-type') { - $found = $key; - } - } - if ($value) { - if (!$found) { - $this->_specificOptions['memorize_headers'][] = 'Content-Type'; - } - } else { - if ($found) { - unset($this->_specificOptions['memorize_headers'][$found]); - } - } - } - - /** - * Specific setter for the 'regexps' option (with some additional tests). - * - * @param mixed $regexps - */ - protected function _setRegexps($regexps) - { - if (!is_array($regexps)) { - Zend_Cache::throwException('regexps option must be an array !'); - } - foreach ($regexps as $regexp => $conf) { - if (!is_array($conf)) { - Zend_Cache::throwException('regexps option must be an array of arrays !'); - } - $validKeys = array_keys($this->_specificOptions['default_options']); - foreach ($conf as $key => $value) { - if (!is_string($key)) { - Zend_Cache::throwException("unknown option [$key] !"); - } - $key = strtolower($key); - if (!in_array($key, $validKeys)) { - unset($regexps[$regexp][$key]); - } - } - } - $this->setOption('regexps', $regexps); - } - - /** - * Start the cache. - * - * @param string $id (optional) A cache id (if you set a value here, maybe you have to use Output frontend instead) - * @param bool $doNotDie For unit testing only ! - * - * @return bool True if the cache is hit (false else) - */ - public function start($id = false, $doNotDie = false) - { - $this->_cancel = false; - $lastMatchingRegexp = null; - if (isset($_SERVER['REQUEST_URI'])) { - foreach ($this->_specificOptions['regexps'] as $regexp => $conf) { - if (preg_match("`$regexp`", $_SERVER['REQUEST_URI'])) { - $lastMatchingRegexp = $regexp; - } - } - } - $this->_activeOptions = $this->_specificOptions['default_options']; - if ($lastMatchingRegexp !== null) { - $conf = $this->_specificOptions['regexps'][$lastMatchingRegexp]; - foreach ($conf as $key => $value) { - $this->_activeOptions[$key] = $value; - } - } - if (!($this->_activeOptions['cache'])) { - return false; - } - if (!$id) { - $id = $this->_makeId(); - if (!$id) { - return false; - } - } - $array = $this->load($id); - if ($array !== false) { - $data = $array['data']; - $headers = $array['headers']; - if (!headers_sent()) { - foreach ($headers as $key => $headerCouple) { - $name = $headerCouple[0]; - $value = $headerCouple[1]; - header("$name: $value"); - } - } - if ($this->_specificOptions['debug_header']) { - echo 'DEBUG HEADER : This is a cached page !'; - } - echo $data; - if ($doNotDie) { - return true; - } - die(); - } - ob_start([$this, '_flush']); - ob_implicit_flush(false); - - return false; - } - - /** - * Cancel the current caching process. - */ - public function cancel() - { - $this->_cancel = true; - } - - /** - * callback for output buffering - * (shouldn't really be called manually). - * - * @param string $data Buffered output - * - * @return string Data to send to browser - */ - public function _flush($data) - { - if ($this->_cancel) { - return $data; - } - $contentType = null; - $storedHeaders = []; - $headersList = headers_list(); - foreach ($this->_specificOptions['memorize_headers'] as $key => $headerName) { - foreach ($headersList as $headerSent) { - $tmp = explode(':', $headerSent); - $headerSentName = trim(array_shift($tmp)); - if (strtolower($headerName) == strtolower($headerSentName)) { - $headerSentValue = trim(implode(':', $tmp)); - $storedHeaders[] = [$headerSentName, $headerSentValue]; - } - } - } - $array = [ - 'data' => $data, - 'headers' => $storedHeaders, - ]; - $this->save($array, null, $this->_activeOptions['tags'], $this->_activeOptions['specific_lifetime'], $this->_activeOptions['priority']); - - return $data; - } - - /** - * Make an id depending on REQUEST_URI and superglobal arrays (depending on options). - * - * @return false|mixed a cache id (string), false if the cache should have not to be used - */ - protected function _makeId() - { - $tmp = $_SERVER['REQUEST_URI']; - $array = explode('?', $tmp, 2); - $tmp = $array[0]; - foreach (['Get', 'Post', 'Session', 'Files', 'Cookie'] as $arrayName) { - $tmp2 = $this->_makePartialId($arrayName, $this->_activeOptions['cache_with_' . strtolower($arrayName) . '_variables'], $this->_activeOptions['make_id_with_' . strtolower($arrayName) . '_variables']); - if ($tmp2 === false) { - return false; - } - $tmp = $tmp . $tmp2; - } - - return md5($tmp); - } - - /** - * Make a partial id depending on options. - * - * @param string $arrayName Superglobal array name - * @param bool $bool1 If true, cache is still on even if there are some variables in the superglobal array - * @param bool $bool2 If true, we have to use the content of the superglobal array to make a partial id - * - * @return false|mixed Partial id (string) or false if the cache should have not to be used - */ - protected function _makePartialId($arrayName, $bool1, $bool2) - { - switch ($arrayName) { - case 'Get': - $var = $_GET; - - break; - case 'Post': - $var = $_POST; - - break; - case 'Session': - if (isset($_SESSION)) { - $var = $_SESSION; - } else { - $var = null; - } - - break; - case 'Cookie': - if (isset($_COOKIE)) { - $var = $_COOKIE; - } else { - $var = null; - } - - break; - case 'Files': - $var = $_FILES; - - break; - default: - return false; - } - if ($bool1) { - if ($bool2) { - return serialize($var); - } - - return ''; - } - if (count((array) $var) > 0) { - return false; - } - - return ''; - } -} diff --git a/library/Zend/Cache/Manager.php b/library/Zend/Cache/Manager.php deleted file mode 100644 index 6a3f32dfb..000000000 --- a/library/Zend/Cache/Manager.php +++ /dev/null @@ -1,315 +0,0 @@ - [ - 'frontend' => [ - 'name' => 'Core', - 'options' => [ - 'automatic_serialization' => true, - ], - ], - 'backend' => [ - 'name' => 'File', - 'options' => [ - // use system temp dir by default of file backend - // 'cache_dir' => '../cache', - ], - ], - ], - - // Static Page HTML Cache - 'page' => [ - 'frontend' => [ - 'name' => 'Capture', - 'options' => [ - 'ignore_user_abort' => true, - ], - ], - 'backend' => [ - 'name' => 'Static', - 'options' => [ - 'public_dir' => '../public', - ], - ], - ], - - // Tag Cache - 'pagetag' => [ - 'frontend' => [ - 'name' => 'Core', - 'options' => [ - 'automatic_serialization' => true, - 'lifetime' => null, - ], - ], - 'backend' => [ - 'name' => 'File', - 'options' => [ - // use system temp dir by default of file backend - // 'cache_dir' => '../cache', - // use default umask of file backend - // 'cache_file_umask' => 0644 - ], - ], - ], - ]; - - /** - * Set a new cache for the Cache Manager to contain. - * - * @param string $name - * - * @return Zend_Cache_Manager - */ - public function setCache($name, Zend_Cache_Core $cache) - { - $this->_caches[$name] = $cache; - - return $this; - } - - /** - * Check if the Cache Manager contains the named cache object, or a named - * configuration template to lazy load the cache object. - * - * @param string $name - * - * @return bool - */ - public function hasCache($name) - { - if (isset($this->_caches[$name]) - || $this->hasCacheTemplate($name) - ) { - return true; - } - - return false; - } - - /** - * Fetch the named cache object, or instantiate and return a cache object - * using a named configuration template. - * - * @param string $name - * - * @return Zend_Cache_Core - */ - public function getCache($name) - { - if (isset($this->_caches[$name])) { - return $this->_caches[$name]; - } - if (isset($this->_optionTemplates[$name])) { - if ($name == self::PAGECACHE - && (!isset($this->_optionTemplates[$name]['backend']['options']['tag_cache']) - || !$this->_optionTemplates[$name]['backend']['options']['tag_cache'] instanceof Zend_Cache_Core) - ) { - $this->_optionTemplates[$name]['backend']['options']['tag_cache'] - = $this->getCache(self::PAGETAGCACHE); - } - - $this->_caches[$name] = Zend_Cache::factory( - $this->_optionTemplates[$name]['frontend']['name'], - $this->_optionTemplates[$name]['backend']['name'], - $this->_optionTemplates[$name]['frontend']['options'] ?? [], - $this->_optionTemplates[$name]['backend']['options'] ?? [], - $this->_optionTemplates[$name]['frontend']['customFrontendNaming'] ?? false, - $this->_optionTemplates[$name]['backend']['customBackendNaming'] ?? false, - $this->_optionTemplates[$name]['frontendBackendAutoload'] ?? false - ); - - return $this->_caches[$name]; - } - } - - /** - * Fetch all available caches. - * - * @return array An array of all available caches with it's names as key - */ - public function getCaches() - { - $caches = $this->_caches; - foreach ($this->_optionTemplates as $name => $tmp) { - if (!isset($caches[$name])) { - $caches[$name] = $this->getCache($name); - } - } - - return $caches; - } - - /** - * Set a named configuration template from which a cache object can later - * be lazy loaded. - * - * @param string $name - * @param array $options - * - * @return Zend_Cache_Manager - */ - public function setCacheTemplate($name, $options) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (!is_array($options)) { - require_once 'Zend/Cache/Exception.php'; - - throw new Zend_Cache_Exception('Options passed must be in' - . ' an associative array or instance of Zend_Config'); - } - $this->_optionTemplates[$name] = $options; - - return $this; - } - - /** - * Check if the named configuration template. - * - * @param string $name - * - * @return bool - */ - public function hasCacheTemplate($name) - { - if (isset($this->_optionTemplates[$name])) { - return true; - } - - return false; - } - - /** - * Get the named configuration template. - * - * @param string $name - * - * @return array - */ - public function getCacheTemplate($name) - { - if (isset($this->_optionTemplates[$name])) { - return $this->_optionTemplates[$name]; - } - } - - /** - * Pass an array containing changes to be applied to a named - * configuration - * template. - * - * @param string $name - * @param array $options - * - * @return Zend_Cache_Manager - */ - public function setTemplateOptions($name, $options) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (!is_array($options)) { - require_once 'Zend/Cache/Exception.php'; - - throw new Zend_Cache_Exception('Options passed must be in' - . ' an associative array or instance of Zend_Config'); - } - if (!isset($this->_optionTemplates[$name])) { - throw new Zend_Cache_Exception('A cache configuration template' - . 'does not exist with the name "' . $name . '"'); - } - $this->_optionTemplates[$name] - = $this->_mergeOptions($this->_optionTemplates[$name], $options); - - return $this; - } - - /** - * Simple method to merge two configuration arrays. - * - * @return array - */ - protected function _mergeOptions(array $current, array $options) - { - if (isset($options['frontend']['name'])) { - $current['frontend']['name'] = $options['frontend']['name']; - } - if (isset($options['backend']['name'])) { - $current['backend']['name'] = $options['backend']['name']; - } - if (isset($options['frontend']['options'])) { - foreach ($options['frontend']['options'] as $key => $value) { - $current['frontend']['options'][$key] = $value; - } - } - if (isset($options['backend']['options'])) { - foreach ($options['backend']['options'] as $key => $value) { - $current['backend']['options'][$key] = $value; - } - } - if (isset($options['frontend']['customFrontendNaming'])) { - $current['frontend']['customFrontendNaming'] = $options['frontend']['customFrontendNaming']; - } - if (isset($options['backend']['customBackendNaming'])) { - $current['backend']['customBackendNaming'] = $options['backend']['customBackendNaming']; - } - if (isset($options['frontendBackendAutoload'])) { - $current['frontendBackendAutoload'] = $options['frontendBackendAutoload']; - } - - return $current; - } -} diff --git a/library/Zend/Captcha/Adapter.php b/library/Zend/Captcha/Adapter.php deleted file mode 100644 index 2583c4b78..000000000 --- a/library/Zend/Captcha/Adapter.php +++ /dev/null @@ -1,70 +0,0 @@ -_name; - } - - /** - * Set name. - * - * @param string $name - * - * @return Zend_Captcha_Adapter - */ - public function setName($name) - { - $this->_name = $name; - - return $this; - } - - /** - * Constructor. - * - * @param array|Zend_Config $options - */ - public function __construct($options = null) - { - // Set options - if (is_array($options)) { - $this->setOptions($options); - } elseif ($options instanceof Zend_Config) { - $this->setConfig($options); - } - } - - /** - * Set single option for the object. - * - * @param string $key - * @param string $value - * - * @return Zend_Form_Element - */ - public function setOption($key, $value) - { - if (in_array(strtolower($key), $this->_skipOptions)) { - return $this; - } - - $method = 'set' . ucfirst($key); - if (method_exists($this, $method)) { - // Setter exists; use it - $this->$method($value); - $this->_options[$key] = $value; - } elseif (property_exists($this, $key)) { - // Assume it's metadata - $this->$key = $value; - $this->_options[$key] = $value; - } - - return $this; - } - - /** - * Set object state from options array. - * - * @param array $options - * - * @return Zend_Form_Element - */ - public function setOptions($options = null) - { - foreach ($options as $key => $value) { - $this->setOption($key, $value); - } - - return $this; - } - - /** - * Retrieve options representing object state. - * - * @return array - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Set object state from config object. - * - * @return Zend_Captcha_Base - */ - public function setConfig(Zend_Config $config) - { - return $this->setOptions($config->toArray()); - } - - /** - * Get optional decorator. - * - * By default, return null, indicating no extra decorator needed. - */ - public function getDecorator() - { - return null; - } -} diff --git a/library/Zend/Captcha/Dumb.php b/library/Zend/Captcha/Dumb.php deleted file mode 100644 index 77059ee56..000000000 --- a/library/Zend/Captcha/Dumb.php +++ /dev/null @@ -1,73 +0,0 @@ -_label = $label; - } - - /** - * Retrieve the label for the CAPTCHA. - * - * @return string - */ - public function getLabel() - { - return $this->_label; - } - - /** - * Render the captcha. - * - * @param mixed $element - * - * @return string - */ - public function render(?Zend_View_Interface $view = null, $element = null) - { - return $this->getLabel() . ': ' - . strrev($this->getWord()) - . ''; - } -} diff --git a/library/Zend/Captcha/Exception.php b/library/Zend/Captcha/Exception.php deleted file mode 100755 index bd93f5bb4..000000000 --- a/library/Zend/Captcha/Exception.php +++ /dev/null @@ -1,33 +0,0 @@ -_figlet = new Zend_Text_Figlet($options); - } - - /** - * Generate new captcha. - * - * @return string - */ - public function generate() - { - $this->_useNumbers = false; - - return parent::generate(); - } - - /** - * Display the captcha. - * - * @param mixed $element - * - * @return string - */ - public function render(?Zend_View_Interface $view = null, $element = null) - { - return '
'
-             . $this->_figlet->render($this->getWord())
-             . "
\n"; - } -} diff --git a/library/Zend/Captcha/Image.php b/library/Zend/Captcha/Image.php deleted file mode 100644 index 09d7f08d1..000000000 --- a/library/Zend/Captcha/Image.php +++ /dev/null @@ -1,663 +0,0 @@ -_imgAlt; - } - - /** - * @return string - */ - public function getStartImage() - { - return $this->_startImage; - } - - /** - * @return int - */ - public function getDotNoiseLevel() - { - return $this->_dotNoiseLevel; - } - - /** - * @return int - */ - public function getLineNoiseLevel() - { - return $this->_lineNoiseLevel; - } - - /** - * Get captcha expiration. - * - * @return int - */ - public function getExpiration() - { - return $this->_expiration; - } - - /** - * Get garbage collection frequency. - * - * @return int - */ - public function getGcFreq() - { - return $this->_gcFreq; - } - - /** - * Get font to use when generating captcha. - * - * @return string - */ - public function getFont() - { - return $this->_font; - } - - /** - * Get font size. - * - * @return int - */ - public function getFontSize() - { - return $this->_fsize; - } - - /** - * Get captcha image height. - * - * @return int - */ - public function getHeight() - { - return $this->_height; - } - - /** - * Get captcha image directory. - * - * @return string - */ - public function getImgDir() - { - return $this->_imgDir; - } - - /** - * Get captcha image base URL. - * - * @return string - */ - public function getImgUrl() - { - return $this->_imgUrl; - } - - /** - * Get captcha image file suffix. - * - * @return string - */ - public function getSuffix() - { - return $this->_suffix; - } - - /** - * Get captcha image width. - * - * @return int - */ - public function getWidth() - { - return $this->_width; - } - - /** - * Set start image. - * - * @param string $startImage - * - * @return Zend_Captcha_Image - */ - public function setStartImage($startImage) - { - $this->_startImage = $startImage; - - return $this; - } - - /** - * Set dot noise level. - * - * @param int $dotNoiseLevel - * - * @return Zend_Captcha_Image - */ - public function setDotNoiseLevel($dotNoiseLevel) - { - $this->_dotNoiseLevel = $dotNoiseLevel; - - return $this; - } - - /** - * Set line noise level. - * - * @param int $lineNoiseLevel - * - * @return Zend_Captcha_Image - */ - public function setLineNoiseLevel($lineNoiseLevel) - { - $this->_lineNoiseLevel = $lineNoiseLevel; - - return $this; - } - - /** - * Set captcha expiration. - * - * @param int $expiration - * - * @return Zend_Captcha_Image - */ - public function setExpiration($expiration) - { - $this->_expiration = $expiration; - - return $this; - } - - /** - * Set garbage collection frequency. - * - * @param int $gcFreq - * - * @return Zend_Captcha_Image - */ - public function setGcFreq($gcFreq) - { - $this->_gcFreq = $gcFreq; - - return $this; - } - - /** - * Set captcha font. - * - * @param string $font - * - * @return Zend_Captcha_Image - */ - public function setFont($font) - { - $this->_font = $font; - - return $this; - } - - /** - * Set captcha font size. - * - * @param int $fsize - * - * @return Zend_Captcha_Image - */ - public function setFontSize($fsize) - { - $this->_fsize = $fsize; - - return $this; - } - - /** - * Set captcha image height. - * - * @param int $height - * - * @return Zend_Captcha_Image - */ - public function setHeight($height) - { - $this->_height = $height; - - return $this; - } - - /** - * Set captcha image storage directory. - * - * @param string $imgDir - * - * @return Zend_Captcha_Image - */ - public function setImgDir($imgDir) - { - $this->_imgDir = rtrim($imgDir, '/\\') . '/'; - - return $this; - } - - /** - * Set captcha image base URL. - * - * @param string $imgUrl - * - * @return Zend_Captcha_Image - */ - public function setImgUrl($imgUrl) - { - $this->_imgUrl = rtrim($imgUrl, '/\\') . '/'; - - return $this; - } - - /** - * Set image alternative text. - * - * @param string $imgAlt - * - * @return Zend_Captcha_Image - */ - public function setImgAlt($imgAlt) - { - $this->_imgAlt = $imgAlt; - - return $this; - } - - /** - * Set captch image filename suffix. - * - * @param string $suffix - * - * @return Zend_Captcha_Image - */ - public function setSuffix($suffix) - { - $this->_suffix = $suffix; - - return $this; - } - - /** - * Set captcha image width. - * - * @param int $width - * - * @return Zend_Captcha_Image - */ - public function setWidth($width) - { - $this->_width = $width; - - return $this; - } - - /** - * Generate random frequency. - * - * @return float - */ - protected function _randomFreq() - { - return random_int(700000, 1_000_000) / 15_000_000; - } - - /** - * Generate random phase. - * - * @return float - */ - protected function _randomPhase() - { - // random phase from 0 to pi - return random_int(0, 3_141_592) / 1_000_000; - } - - /** - * Generate random character size. - * - * @return int - */ - protected function _randomSize() - { - return random_int(300, 700) / 100; - } - - /** - * Generate captcha. - * - * @return string captcha ID - */ - public function generate() - { - $id = parent::generate(); - $tries = 5; - // If there's already such file, try creating a new ID - while ($tries-- && file_exists($this->getImgDir() . $id . $this->getSuffix())) { - $id = $this->_generateRandomId(); - $this->_setId($id); - } - $this->_generateImage($id, $this->getWord()); - - if (random_int(1, $this->getGcFreq()) == 1) { - $this->_gc(); - } - - return $id; - } - - /** - * Generate image captcha. - * - * Override this function if you want different image generator - * Wave transform from http://www.captcha.ru/captchas/multiwave/ - * - * @param string $id Captcha ID - * @param string $word Captcha word - */ - protected function _generateImage($id, $word) - { - if (!extension_loaded('gd')) { - require_once 'Zend/Captcha/Exception.php'; - - throw new Zend_Captcha_Exception('Image CAPTCHA requires GD extension'); - } - - if (!function_exists('imagepng')) { - require_once 'Zend/Captcha/Exception.php'; - - throw new Zend_Captcha_Exception('Image CAPTCHA requires PNG support'); - } - - if (!function_exists('imageftbbox')) { - require_once 'Zend/Captcha/Exception.php'; - - throw new Zend_Captcha_Exception('Image CAPTCHA requires FT fonts support'); - } - - $font = $this->getFont(); - - if (empty($font)) { - require_once 'Zend/Captcha/Exception.php'; - - throw new Zend_Captcha_Exception('Image CAPTCHA requires font'); - } - - $w = $this->getWidth(); - $h = $this->getHeight(); - $fsize = $this->getFontSize(); - - $img_file = $this->getImgDir() . $id . $this->getSuffix(); - if (empty($this->_startImage)) { - $img = imagecreatetruecolor($w, $h); - } else { - $img = imagecreatefrompng($this->_startImage); - if (!$img) { - require_once 'Zend/Captcha/Exception.php'; - - throw new Zend_Captcha_Exception('Can not load start image'); - } - $w = imagesx($img); - $h = imagesy($img); - } - $text_color = imagecolorallocate($img, 0, 0, 0); - $bg_color = imagecolorallocate($img, 255, 255, 255); - imagefilledrectangle($img, 0, 0, $w - 1, $h - 1, $bg_color); - $textbox = imageftbbox($fsize, 0, $font, $word); - $x = ($w - ($textbox[2] - $textbox[0])) / 2; - $y = ($h - ($textbox[7] - $textbox[1])) / 2; - imagefttext($img, $fsize, 0, (int) $x,(int) $y, $text_color, $font, $word); - - // generate noise - for ($i = 0; $i < $this->_dotNoiseLevel; ++$i) { - imagefilledellipse($img, random_int(0,$w), random_int(0,$h), 2, 2, $text_color); - } - for ($i = 0; $i < $this->_lineNoiseLevel; ++$i) { - imageline($img, random_int(0,$w), random_int(0,$h), random_int(0,$w), random_int(0,$h), $text_color); - } - - // transformed image - $img2 = imagecreatetruecolor($w, $h); - $bg_color = imagecolorallocate($img2, 255, 255, 255); - imagefilledrectangle($img2, 0, 0, $w - 1, $h - 1, $bg_color); - // apply wave transforms - $freq1 = $this->_randomFreq(); - $freq2 = $this->_randomFreq(); - $freq3 = $this->_randomFreq(); - $freq4 = $this->_randomFreq(); - - $ph1 = $this->_randomPhase(); - $ph2 = $this->_randomPhase(); - $ph3 = $this->_randomPhase(); - $ph4 = $this->_randomPhase(); - - $szx = $this->_randomSize(); - $szy = $this->_randomSize(); - - for ($x = 0; $x < $w; ++$x) { - for ($y = 0; $y < $h; ++$y) { - $sx = $x + (sin($x * $freq1 + $ph1) + sin($y * $freq3 + $ph3)) * $szx; - $sy = $y + (sin($x * $freq2 + $ph2) + sin($y * $freq4 + $ph4)) * $szy; - - if ($sx < 0 || $sy < 0 || $sx >= $w - 1 || $sy >= $h - 1) { - continue; - } - $color = (imagecolorat($img, (int) $sx,(int) $sy) >> 16) & 0xFF; - $color_x = (imagecolorat($img, (int) $sx + 1,(int) $sy) >> 16) & 0xFF; - $color_y = (imagecolorat($img, (int) $sx,(int) $sy + 1) >> 16) & 0xFF; - $color_xy = (imagecolorat($img, (int) $sx + 1,(int) $sy + 1) >> 16) & 0xFF; - - if ($color == 255 && $color_x == 255 && $color_y == 255 && $color_xy == 255) { - // ignore background - continue; - } - if ($color == 0 && $color_x == 0 && $color_y == 0 && $color_xy == 0) { - // transfer inside of the image as-is - $newcolor = 0; - } else { - // do antialiasing for border items - $frac_x = $sx - floor($sx); - $frac_y = $sy - floor($sy); - $frac_x1 = 1 - $frac_x; - $frac_y1 = 1 - $frac_y; - - $newcolor = $color * $frac_x1 * $frac_y1 - + $color_x * $frac_x * $frac_y1 - + $color_y * $frac_x1 * $frac_y - + $color_xy * $frac_x * $frac_y; - } - imagesetpixel($img2, $x, $y, imagecolorallocate($img2,(int) $newcolor,(int) $newcolor,(int) $newcolor)); - } - } - - // generate noise - for ($i = 0; $i < $this->_dotNoiseLevel; ++$i) { - imagefilledellipse($img2, random_int(0,$w), random_int(0,$h), 2, 2, $text_color); - } - for ($i = 0; $i < $this->_lineNoiseLevel; ++$i) { - imageline($img2, random_int(0,$w), random_int(0,$h), random_int(0,$w), random_int(0,$h), $text_color); - } - - imagepng($img2, $img_file); - imagedestroy($img); - imagedestroy($img2); - } - - /** - * Remove old files from image directory. - */ - protected function _gc() - { - $expire = time() - $this->getExpiration(); - $imgdir = $this->getImgDir(); - if (!$imgdir || strlen($imgdir) < 2) { - // safety guard - return; - } - $suffixLength = strlen($this->_suffix); - foreach (new DirectoryIterator($imgdir) as $file) { - if (!$file->isDot() && !$file->isDir()) { - if (file_exists($file->getPathname()) && $file->getMTime() < $expire) { - // only deletes files ending with $this->_suffix - if (substr($file->getFilename(), -($suffixLength)) == $this->_suffix) { - unlink($file->getPathname()); - } - } - } - } - } - - /** - * Display the captcha. - * - * @param mixed $element - * - * @return string - */ - public function render(?Zend_View_Interface $view = null, $element = null) - { - $endTag = ' />'; - if (($view instanceof Zend_View_Abstract) && !$view->doctype()->isXhtml()) { - $endTag = '>'; - } - - return '' . $this->getImgAlt()
-             . ' 'Empty captcha value', - self::MISSING_ID => 'Captcha ID field is missing', - self::BAD_CAPTCHA => 'Captcha value is wrong', - ]; - - /** - * Length of the word to generate. - * - * @var int - */ - protected $_wordlen = 8; - - /** - * Retrieve session class to utilize. - * - * @return string - */ - public function getSessionClass() - { - return $this->_sessionClass; - } - - /** - * Set session class for persistence. - * - * @param string $_sessionClass - * - * @return Zend_Captcha_Word - */ - public function setSessionClass($_sessionClass) - { - $this->_sessionClass = $_sessionClass; - - return $this; - } - - /** - * Retrieve word length to use when genrating captcha. - * - * @return int - */ - public function getWordlen() - { - return $this->_wordlen; - } - - /** - * Set word length of captcha. - * - * @param int $wordlen - * - * @return Zend_Captcha_Word - */ - public function setWordlen($wordlen) - { - $this->_wordlen = $wordlen; - - return $this; - } - - /** - * Retrieve captcha ID. - * - * @return string - */ - public function getId() - { - if (null === $this->_id) { - $this->_setId($this->_generateRandomId()); - } - - return $this->_id; - } - - /** - * Set captcha identifier. - * - * @param string $id - * - * @return Zend_Captcha_Word - */ - protected function _setId($id) - { - $this->_id = $id; - - return $this; - } - - /** - * Set timeout for session token. - * - * @param int $ttl - * - * @return Zend_Captcha_Word - */ - public function setTimeout($ttl) - { - $this->_timeout = (int) $ttl; - - return $this; - } - - /** - * Get session token timeout. - * - * @return int - */ - public function getTimeout() - { - return $this->_timeout; - } - - /** - * Sets if session should be preserved on generate(). - * - * @param bool $keepSession Should session be kept on generate()? - * - * @return Zend_Captcha_Word - */ - public function setKeepSession($keepSession) - { - $this->_keepSession = $keepSession; - - return $this; - } - - /** - * Numbers should be included in the pattern? - * - * @return bool - */ - public function getUseNumbers() - { - return $this->_useNumbers; - } - - /** - * Set if numbers should be included in the pattern. - * - * @param bool $_useNumbers numbers should be included in the pattern? - * - * @return Zend_Captcha_Word - */ - public function setUseNumbers($_useNumbers) - { - $this->_useNumbers = $_useNumbers; - - return $this; - } - - /** - * Get session object. - * - * @return Zend_Session_Namespace - */ - public function getSession() - { - if (!isset($this->_session) || (null === $this->_session)) { - $id = $this->getId(); - if (!class_exists($this->_sessionClass)) { - require_once 'Zend/Loader.php'; - Zend_Loader::loadClass($this->_sessionClass); - } - $this->_session = new $this->_sessionClass('Zend_Form_Captcha_' . $id); - $this->_session->setExpirationHops(1, null, true); - $this->_session->setExpirationSeconds($this->getTimeout()); - } - - return $this->_session; - } - - /** - * Set session namespace object. - * - * @return Zend_Captcha_Word - */ - public function setSession(Zend_Session_Namespace $session) - { - $this->_session = $session; - if ($session) { - $this->_keepSession = true; - } - - return $this; - } - - /** - * Get captcha word. - * - * @return string - */ - public function getWord() - { - if (empty($this->_word)) { - $session = $this->getSession(); - $this->_word = $session->word; - } - - return $this->_word; - } - - /** - * Set captcha word. - * - * @param string $word - * - * @return Zend_Captcha_Word - */ - protected function _setWord($word) - { - $session = $this->getSession(); - $session->word = $word; - $this->_word = $word; - - return $this; - } - - /** - * Generate new random word. - * - * @return string - */ - protected function _generateWord() - { - $word = ''; - $wordLen = $this->getWordLen(); - $vowels = $this->_useNumbers ? self::$VN : self::$V; - $consonants = $this->_useNumbers ? self::$CN : self::$C; - - $totIndexCon = count($consonants) - 1; - $totIndexVow = count($vowels) - 1; - for ($i = 0; $i < $wordLen; $i = $i + 2) { - // generate word with mix of vowels and consonants - $consonant = $consonants[random_int(0, $totIndexCon)]; - $vowel = $vowels[random_int(0, $totIndexVow)]; - $word .= $consonant . $vowel; - } - - if (strlen($word) > $wordLen) { - $word = substr($word, 0, $wordLen); - } - - return $word; - } - - /** - * Generate new session ID and new word. - * - * @return string session ID - */ - public function generate() - { - if (!$this->_keepSession) { - $this->_session = null; - } - $id = $this->_generateRandomId(); - $this->_setId($id); - $word = $this->_generateWord(); - $this->_setWord($word); - - return $id; - } - - protected function _generateRandomId() - { - return md5(random_bytes(32)); - } - - /** - * Validate the word. - * - * @see Zend_Validate_Interface::isValid() - * - * @param mixed $value - * @param null|array $context - * - * @return bool - */ - public function isValid($value, $context = null) - { - if (!is_array($value) && !is_array($context)) { - $this->_error(self::MISSING_VALUE); - - return false; - } - if (!is_array($value) && is_array($context)) { - $value = $context; - } - - $name = $this->getName(); - - if (isset($value[$name])) { - $value = $value[$name]; - } - - if (!isset($value['input'])) { - $this->_error(self::MISSING_VALUE); - - return false; - } - $input = strtolower($value['input']); - $this->_setValue($input); - - if (!isset($value['id'])) { - $this->_error(self::MISSING_ID); - - return false; - } - - $this->_id = $value['id']; - if ($input !== $this->getWord()) { - $this->_error(self::BAD_CAPTCHA); - - return false; - } - - return true; - } - - /** - * Get captcha decorator. - * - * @return string - */ - public function getDecorator() - { - return 'Captcha_Word'; - } -} diff --git a/library/Zend/Config.php b/library/Zend/Config.php index 21f357feb..2f0739502 100644 --- a/library/Zend/Config.php +++ b/library/Zend/Config.php @@ -1,4 +1,5 @@ _count = count((array) $this->_data); } else { - /** @see Zend_Config_Exception */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception('Zend_Config is read only'); } } @@ -226,9 +224,6 @@ public function __unset($name) $this->_count = count((array) $this->_data); $this->_skipNextIteration = true; } else { - /** @see Zend_Config_Exception */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception('Zend_Config is read only'); } } @@ -406,9 +401,6 @@ protected function _assertValidExtend($extendingSection, $extendedSection) $extendedSectionCurrent = $extendedSection; while (array_key_exists($extendedSectionCurrent, $this->_extends)) { if ($this->_extends[$extendedSectionCurrent] == $extendingSection) { - /** @see Zend_Config_Exception */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception('Illegal circular inheritance detected'); } $extendedSectionCurrent = $this->_extends[$extendedSectionCurrent]; diff --git a/library/Zend/Config/Exception.php b/library/Zend/Config/Exception.php index e6ebf9763..488def3a9 100644 --- a/library/Zend/Config/Exception.php +++ b/library/Zend/Config/Exception.php @@ -1,4 +1,5 @@ _arrayMergeRecursive($this->_processSection($iniArray, $sectionName), $dataArray); @@ -168,11 +154,6 @@ protected function _parseIniFile($filename) // Check if there was a error while loading file if ($this->_loadFileErrorStr !== null) { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception($this->_loadFileErrorStr); } @@ -211,11 +192,6 @@ protected function _loadIniFile($filename) break; default: - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Section '$thisSection' may not extend multiple sections in $filename"); } } @@ -247,11 +223,6 @@ protected function _processSection($iniArray, $section, $config = []) $config = $this->_processSection($iniArray, $value, $config); } } else { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Parent section '$section' cannot be found"); } } else { @@ -285,20 +256,10 @@ protected function _processKey($config, $key, $value) $config[$pieces[0]] = []; } } elseif (!is_array($config[$pieces[0]])) { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Cannot create sub-key for '{$pieces[0]}' as key already exists"); } $config[$pieces[0]] = $this->_processKey($config[$pieces[0]], $pieces[1], $value); } else { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Invalid key '$key'"); } } else { diff --git a/library/Zend/Config/Xml.php b/library/Zend/Config/Xml.php index 176dd4cd2..67ed8a64b 100644 --- a/library/Zend/Config/Xml.php +++ b/library/Zend/Config/Xml.php @@ -1,4 +1,5 @@ getMessage() ); @@ -119,8 +106,6 @@ public function __construct($xml, $section = null, $options = false) restore_error_handler(); // Check if there was a error while loading file if ($this->_loadFileErrorStr !== null) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception($this->_loadFileErrorStr); } @@ -135,8 +120,6 @@ public function __construct($xml, $section = null, $options = false) $dataArray = []; foreach ($section as $sectionName) { if (!isset($config->$sectionName)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Section '$sectionName' cannot be found in $xml"); } @@ -146,8 +129,6 @@ public function __construct($xml, $section = null, $options = false) parent::__construct($dataArray, $allowModifications); } else { if (!isset($config->$section)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Section '$section' cannot be found in $xml"); } @@ -176,8 +157,6 @@ public function __construct($xml, $section = null, $options = false) protected function _processExtends(SimpleXMLElement $element, $section, array $config = []) { if (!isset($element->$section)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Section '$section' cannot be found"); } @@ -235,8 +214,6 @@ protected function _toArray(SimpleXMLElement $xmlObject) // Search for local 'const' nodes and replace them if (count($xmlObject->children(self::XML_NAMESPACE)) > 0) { if (count($xmlObject->children()) > 0) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("A node with a 'const' childnode may not have any other children"); } @@ -255,16 +232,12 @@ protected function _toArray(SimpleXMLElement $xmlObject) switch ($node->localName) { case 'const': if (!$node->hasAttributeNS(self::XML_NAMESPACE, 'name')) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Misssing 'name' attribute in 'const' node"); } $constantName = $node->getAttributeNS(self::XML_NAMESPACE, 'name'); if (!defined($constantName)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Constant with name '$constantName' was not defined"); } @@ -275,8 +248,6 @@ protected function _toArray(SimpleXMLElement $xmlObject) break; default: - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Unknown node with name '$node->localName' found"); } } diff --git a/library/Zend/Console/Getopt.php b/library/Zend/Console/Getopt.php index 7e653f273..dcd257ae4 100644 --- a/library/Zend/Console/Getopt.php +++ b/library/Zend/Console/Getopt.php @@ -1,4 +1,5 @@ appendChild($optionsNode); foreach ($this->_options as $flag => $value) { $optionNode = $doc->createElement('option'); - $optionNode->setAttribute('flag', utf8_encode($flag)); + $optionNode->setAttribute('flag', $flag); if ($value !== true) { - $optionNode->setAttribute('parameter', utf8_encode($value)); + $optionNode->setAttribute('parameter', $value); } $optionsNode->appendChild($optionNode); } @@ -667,7 +662,6 @@ public function setAliases($aliasMap) $flag = $this->_ruleMap[$flag]; if (isset($this->_rules[$alias]) || isset($this->_ruleMap[$alias])) { $o = (strlen($alias) == 1 ? '-' : '--') . $alias; - require_once 'Zend/Console/Getopt/Exception.php'; throw new Zend_Console_Getopt_Exception( "Option \"$o\" is being defined more than once."); @@ -758,8 +752,6 @@ public function checkRequiredArguments() $defined = $defined === true ? true : array_key_exists($alias, $this->_options); } if ($defined === false) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( 'Option "$alias" requires a parameter.', $this->getUsageMessage() @@ -815,8 +807,6 @@ protected function _parseSingleOption($flag, &$argv) $flag = strtolower($flag); } if (!isset($this->_ruleMap[$flag])) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"$flag\" is not recognized.", $this->getUsageMessage()); @@ -828,8 +818,6 @@ protected function _parseSingleOption($flag, &$argv) $param = array_shift($argv); $this->_checkParameterType($realFlag, $param); } else { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"$flag\" requires a parameter.", $this->getUsageMessage()); @@ -870,8 +858,6 @@ protected function _checkParameterType($flag, $param) switch ($type) { case 'word': if (preg_match('/\W/', $param)) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"$flag\" requires a single-word parameter, but was given \"$param\".", $this->getUsageMessage()); @@ -880,8 +866,6 @@ protected function _checkParameterType($flag, $param) break; case 'integer': if (preg_match('/\D/', $param)) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"$flag\" requires an integer parameter, but was given \"$param\".", $this->getUsageMessage()); @@ -956,15 +940,11 @@ protected function _addRulesModeZend($rules) $mainFlag = $flags[0]; foreach ($flags as $flag) { if (empty($flag)) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Blank flag not allowed in rule \"$ruleCode\"."); } if (strlen($flag) == 1) { if (isset($this->_ruleMap[$flag])) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"-$flag\" is being defined more than once."); } @@ -972,8 +952,6 @@ protected function _addRulesModeZend($rules) $rule['alias'][] = $flag; } else { if (isset($this->_rules[$flag]) || isset($this->_ruleMap[$flag])) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"--$flag\" is being defined more than once."); } diff --git a/library/Zend/Console/Getopt/Exception.php b/library/Zend/Console/Getopt/Exception.php index 9e943aca6..f0e8cde17 100644 --- a/library/Zend/Console/Getopt/Exception.php +++ b/library/Zend/Console/Getopt/Exception.php @@ -1,4 +1,5 @@ view; } - require_once 'Zend/View/Interface.php'; if (isset($this->view) && ($this->view instanceof Zend_View_Interface)) { return $this->view; } @@ -177,12 +162,9 @@ public function initView() } $baseDir = dirname($dirs[$module]) . DIRECTORY_SEPARATOR . 'views'; if (!file_exists($baseDir) || !is_dir($baseDir)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Missing base view directory ("' . $baseDir . '")'); } - require_once 'Zend/View.php'; $this->view = new Zend_View(['basePath' => $baseDir]); return $this->view; @@ -273,8 +255,6 @@ public function getViewScript($action = null, $noController = null) if (null === $action) { $action = $request->getActionName(); } elseif (!is_string($action)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid action specifier for view render'); } @@ -428,15 +408,13 @@ public function getFrontController() } // Grab singleton instance, if class has been loaded - if (class_exists(\Zend_Controller_Front::class)) { + if (class_exists(Zend_Controller_Front::class)) { $this->_frontController = Zend_Controller_Front::getInstance(); return $this->_frontController; } // Throw exception in all other cases - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Front controller class has not been loaded'); } @@ -478,7 +456,6 @@ public function postDispatch() */ public function __call($methodName, $args) { - require_once 'Zend/Controller/Action/Exception.php'; if ('Action' == substr($methodName, -6)) { $action = substr($methodName, 0, strlen($methodName) - 6); diff --git a/library/Zend/Controller/Action/Exception.php b/library/Zend/Controller/Action/Exception.php index 7e7922261..30ce5bc06 100644 --- a/library/Zend/Controller/Action/Exception.php +++ b/library/Zend/Controller/Action/Exception.php @@ -1,4 +1,5 @@ hasPlugin(\Zend_Controller_Plugin_ActionStack::class)) { - /** - * @see Zend_Controller_Plugin_ActionStack - */ - require_once 'Zend/Controller/Plugin/ActionStack.php'; + if (!$front->hasPlugin(Zend_Controller_Plugin_ActionStack::class)) { + // @see Zend_Controller_Plugin_ActionStack $this->_actionStack = new Zend_Controller_Plugin_ActionStack(); $front->registerPlugin($this->_actionStack, 97); } else { - $this->_actionStack = $front->getPlugin(\Zend_Controller_Plugin_ActionStack::class); + $this->_actionStack = $front->getPlugin(Zend_Controller_Plugin_ActionStack::class); } } @@ -84,22 +77,12 @@ public function actionToStack($action, $controller = null, $module = null, array return $this->pushStack($action); } if (!is_string($action)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('ActionStack requires either a request object or minimally a string action'); } $request = $this->getRequest(); if ($request instanceof Zend_Controller_Request_Abstract === false) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Request object not set yet'); } @@ -109,7 +92,6 @@ public function actionToStack($action, $controller = null, $module = null, array /** * @see Zend_Controller_Request_Simple */ - require_once 'Zend/Controller/Request/Simple.php'; $newRequest = new Zend_Controller_Request_Simple($action, $controller, $module, $params); return $this->pushStack($newRequest); diff --git a/library/Zend/Controller/Action/Helper/AjaxContext.php b/library/Zend/Controller/Action/Helper/AjaxContext.php index 581300884..52d83c100 100644 --- a/library/Zend/Controller/Action/Helper/AjaxContext.php +++ b/library/Zend/Controller/Action/Helper/AjaxContext.php @@ -1,4 +1,5 @@ disableLayout(); } @@ -92,11 +85,6 @@ public function encodeJson($data, $keepLayouts = false) return Zend_Controller_Action_HelperBroker::getStaticHelper('Json')->encodeJson($data, $keepLayouts); } - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid data passed for autocompletion'); } diff --git a/library/Zend/Controller/Action/Helper/Cache.php b/library/Zend/Controller/Action/Helper/Cache.php deleted file mode 100644 index bdfef34e4..000000000 --- a/library/Zend/Controller/Action/Helper/Cache.php +++ /dev/null @@ -1,282 +0,0 @@ -getRequest()->getControllerName(); - $actions = array_unique($actions); - if (!isset($this->_caching[$controller])) { - $this->_caching[$controller] = []; - } - if (!empty($tags)) { - $tags = array_unique($tags); - if (!isset($this->_tags[$controller])) { - $this->_tags[$controller] = []; - } - } - foreach ($actions as $action) { - $this->_caching[$controller][] = $action; - if (!empty($tags)) { - $this->_tags[$controller][$action] = []; - foreach ($tags as $tag) { - $this->_tags[$controller][$action][] = $tag; - } - } - } - if ($extension) { - if (!isset($this->_extensions[$controller])) { - $this->_extensions[$controller] = []; - } - foreach ($actions as $action) { - $this->_extensions[$controller][$action] = $extension; - } - } - } - - /** - * Remove a specific page cache static file based on its - * relative URL from the application's public directory. - * The file extension is not required here; usually matches - * the original REQUEST_URI that was cached. - * - * @param string $relativeUrl - * @param bool $recursive - * - * @return mixed - */ - public function removePage($relativeUrl, $recursive = false) - { - $cache = $this->getCache(Zend_Cache_Manager::PAGECACHE); - $encodedCacheId = $this->_encodeCacheId($relativeUrl); - - if ($recursive) { - $backend = $cache->getBackend(); - if (($backend instanceof Zend_Cache_Backend) - && method_exists($backend, 'removeRecursively') - ) { - $result = $backend->removeRecursively($encodedCacheId); - if (is_null($result)) { - $result = $backend->removeRecursively($relativeUrl); - } - - return $result; - } - } - - $result = $cache->remove($encodedCacheId); - if (is_null($result)) { - $result = $cache->remove($relativeUrl); - } - - return $result; - } - - /** - * Remove a specific page cache static file based on its - * relative URL from the application's public directory. - * The file extension is not required here; usually matches - * the original REQUEST_URI that was cached. - * - * @return mixed - */ - public function removePagesTagged(array $tags) - { - return $this->getCache(Zend_Cache_Manager::PAGECACHE) - ->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, $tags); - } - - /** - * Commence page caching for any cacheable actions. - */ - public function preDispatch() - { - $controller = $this->getRequest()->getControllerName(); - $action = $this->getRequest()->getActionName(); - $stats = ob_get_status(true); - foreach ($stats as $status) { - if ($status['name'] == 'Zend_Cache_Frontend_Page::_flush' - || $status['name'] == 'Zend_Cache_Frontend_Capture::_flush') { - $obStarted = true; - } - } - if (!isset($obStarted) && isset($this->_caching[$controller]) - && in_array($action, $this->_caching[$controller])) { - $reqUri = $this->getRequest()->getRequestUri(); - $tags = []; - if (isset($this->_tags[$controller][$action]) - && !empty($this->_tags[$controller][$action])) { - $tags = array_unique($this->_tags[$controller][$action]); - } - $extension = null; - if (isset($this->_extensions[$controller][$action])) { - $extension = $this->_extensions[$controller][$action]; - } - $this->getCache(Zend_Cache_Manager::PAGECACHE) - ->start($this->_encodeCacheId($reqUri), $tags, $extension); - } - } - - /** - * Encode a Cache ID as hexadecimal. This is a workaround because Backend ID validation - * is trapped in the Frontend classes. Will try to get this reversed for ZF 2.0 - * because it's a major annoyance to have IDs so restricted! - * - * @param string $requestUri - * - * @return string - */ - protected function _encodeCacheId($requestUri) - { - return bin2hex($requestUri); - } - - /** - * Set an instance of the Cache Manager for this helper. - */ - public function setManager(Zend_Cache_Manager $manager) - { - $this->_manager = $manager; - - return $this; - } - - /** - * Get the Cache Manager instance or instantiate the object if not - * exists. Attempts to load from bootstrap if available. - * - * @return Zend_Cache_Manager - */ - public function getManager() - { - if ($this->_manager !== null) { - return $this->_manager; - } - $front = Zend_Controller_Front::getInstance(); - if ($front->getParam('bootstrap') - && $front->getParam('bootstrap')->getResource('CacheManager')) { - return $front->getParam('bootstrap') - ->getResource('CacheManager'); - } - $this->_manager = new Zend_Cache_Manager(); - - return $this->_manager; - } - - /** - * Return a list of actions for the current Controller marked for - * caching. - * - * @return array - */ - public function getCacheableActions() - { - return $this->_caching; - } - - /** - * Return a list of tags set for all cacheable actions. - * - * @return array - */ - public function getCacheableTags() - { - return $this->_tags; - } - - /** - * Proxy non-matched methods back to Zend_Cache_Manager where - * appropriate. - * - * @param string $method - * @param array $args - * - * @return mixed - */ - public function __call($method, $args) - { - if (method_exists($this->getManager(), $method)) { - return call_user_func_array( - [$this->getManager(), $method], $args - ); - } - - throw new Zend_Controller_Action_Exception('Method does not exist:' - . $method); - } -} diff --git a/library/Zend/Controller/Action/Helper/ContextSwitch.php b/library/Zend/Controller/Action/Helper/ContextSwitch.php index 40c3b9373..fe1f87789 100644 --- a/library/Zend/Controller/Action/Helper/ContextSwitch.php +++ b/library/Zend/Controller/Action/Helper/ContextSwitch.php @@ -1,4 +1,5 @@ disableLayout(); @@ -301,11 +296,6 @@ public function initContext($format = null) } elseif (is_array($callback)) { call_user_func($callback); } else { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Invalid context callback registered for context "%s"', $context)); } } @@ -393,11 +383,6 @@ protected function _setSuffix(array $spec) $count = count($suffixInfo); switch (true) { case ($count < 2) && (null === $context): - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid suffix information provided in config'); case $count < 2: $suffix = array_shift($suffixInfo); @@ -445,11 +430,6 @@ protected function _setSuffix(array $spec) public function setSuffix($context, $suffix, $prependViewRendererSuffix = true) { if (!isset($this->_contexts[$context])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot set suffix; invalid context type "%s"', $context)); } @@ -493,11 +473,6 @@ public function setSuffix($context, $suffix, $prependViewRendererSuffix = true) public function getSuffix($type) { if (!isset($this->_contexts[$type])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot retrieve suffix; invalid context type "%s"', $type)); } @@ -536,11 +511,6 @@ public function hasContext($context, $throwException = false) } if ($throwException) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Context "%s" does not exist', $context)); } @@ -565,11 +535,6 @@ public function addHeader($context, $header, $content) $content = (string) $content; if (isset($this->_contexts[$context]['headers'][$header])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot add "%s" header to context "%s": already exists', $header, $context)); } @@ -744,11 +709,6 @@ protected function _validateTrigger($trigger) } if (!in_array($trigger, [self::TRIGGER_INIT, self::TRIGGER_POST])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Invalid trigger "%s"', $trigger)); } @@ -771,11 +731,6 @@ public function setCallback($context, $trigger, $callback) if (!is_string($callback)) { if (!is_array($callback) || (2 != count($callback))) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid callback specified'); } } @@ -930,11 +885,6 @@ public function getContextParam() public function setDefaultContext($type) { if (!isset($this->_contexts[$type])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot set default context; invalid context type "%s"', $type)); } @@ -988,11 +938,6 @@ public function getAutoDisableLayout() public function addContext($context, array $spec) { if ($this->hasContext($context)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot add context "%s"; already exists', $context)); } $context = (string) $context; @@ -1133,11 +1078,6 @@ public function postDispatch() } elseif (is_array($callback)) { call_user_func($callback); } else { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Invalid postDispatch context callback registered for context "%s"', $context)); } } @@ -1158,14 +1098,10 @@ public function postJsonContext() $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $view = $viewRenderer->view; if ($view instanceof Zend_View_Interface) { - // @see Zend_Json if (method_exists($view, 'getVars')) { - require_once 'Zend/Json.php'; $vars = Zend_Json::encode($view->getVars()); $this->getResponse()->setBody($vars); } else { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('View does not implement the getVars() method needed to encode the view into JSON'); } } @@ -1298,11 +1234,6 @@ public function hasActionContext($action, $context) $allContexts = $controller->{$contextKey}; if (!is_array($allContexts)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid contexts found for controller'); } @@ -1317,11 +1248,6 @@ public function hasActionContext($action, $context) $contexts = $allContexts[$action]; if (!is_array($contexts)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf("Invalid contexts found for action '%s'", $action)); } diff --git a/library/Zend/Controller/Action/Helper/FlashMessenger.php b/library/Zend/Controller/Action/Helper/FlashMessenger.php index 18e007c5f..e61a13101 100644 --- a/library/Zend/Controller/Action/Helper/FlashMessenger.php +++ b/library/Zend/Controller/Action/Helper/FlashMessenger.php @@ -1,4 +1,5 @@ json($data, $keepLayouts, $encodeData); if (!$keepLayouts) { - /** - * @see Zend_Controller_Action_HelperBroker - */ - require_once 'Zend/Controller/Action/HelperBroker.php'; + // @see Zend_Controller_Action_HelperBroker Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender(true); } diff --git a/library/Zend/Controller/Action/Helper/Redirector.php b/library/Zend/Controller/Action/Helper/Redirector.php index 3530738d0..04818f522 100644 --- a/library/Zend/Controller/Action/Helper/Redirector.php +++ b/library/Zend/Controller/Action/Helper/Redirector.php @@ -1,4 +1,5 @@ $code) || (307 < $code) || (304 == $code) || (306 == $code)) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid redirect HTTP status code (' . $code . ')'); } @@ -473,7 +467,7 @@ public function redirectAndExit() { if ($this->getCloseSessionOnExit()) { // Close session, if started - if (class_exists(\Zend_Session::class, false) && Zend_Session::isStarted()) { + if (class_exists(Zend_Session::class, false) && Zend_Session::isStarted()) { Zend_Session::writeClose(); } elseif (isset($_SESSION)) { session_write_close(); @@ -520,8 +514,6 @@ public function __call($method, $args) return call_user_func_array([$this, 'gotoSimpleAndExit'], $args); } - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Invalid method "%s" called on redirector', $method)); } } diff --git a/library/Zend/Controller/Action/Helper/Url.php b/library/Zend/Controller/Action/Helper/Url.php index 5bf08febd..de1b3c6f6 100644 --- a/library/Zend/Controller/Action/Helper/Url.php +++ b/library/Zend/Controller/Action/Helper/Url.php @@ -1,4 +1,5 @@ getModule(); $moduleDir = $this->getFrontController()->getControllerDirectory($module); if ((null === $moduleDir) || is_array($moduleDir)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('ViewRenderer cannot locate module directory for module "' . $module . '"'); } $this->_moduleDir = dirname($moduleDir); @@ -264,18 +250,9 @@ public function getModuleDirectory() public function getInflector() { if (null === $this->_inflector) { - /** - * @see Zend_Filter_Inflector - */ - require_once 'Zend/Filter/Inflector.php'; - /** - * @see Zend_Filter_PregReplace - */ - require_once 'Zend/Filter/PregReplace.php'; - /** - * @see Zend_Filter_Word_UnderscoreToSeparator - */ - require_once 'Zend/Filter/Word/UnderscoreToSeparator.php'; + // @see Zend_Filter_Inflector + // @see Zend_Filter_PregReplace + // @see Zend_Filter_Word_UnderscoreToSeparator $this->_inflector = new Zend_Filter_Inflector(); $this->_inflector->setStaticRuleReference('moduleDir', $this->_moduleDir) // moduleDir must be specified before the less specific 'module' ->addRules([ @@ -349,7 +326,7 @@ protected function _getModuleDir() */ protected function _generateDefaultPrefix() { - $default = \Zend_View::class; + $default = Zend_View::class; if (null === $this->_actionController) { return $default; } @@ -469,11 +446,6 @@ public function initView($path = null, $prefix = null, array $options = []) if (empty($path)) { $path = $this->_getBasePath(); if (empty($path)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('ViewRenderer initialization failed: retrieved view base path is empty'); } } @@ -869,7 +841,6 @@ protected function _translateSpec(array $vars = []) $module = $dispatcher->formatModuleName($request->getModuleName()); // Format controller name - require_once 'Zend/Filter/Word/CamelCaseToDash.php'; $filter = new Zend_Filter_Word_CamelCaseToDash(); $controller = $filter->filter($request->getControllerName()); $controller = $dispatcher->formatControllerName($controller); diff --git a/library/Zend/Controller/Action/HelperBroker.php b/library/Zend/Controller/Action/HelperBroker.php index adb7987c3..b89167ca5 100644 --- a/library/Zend/Controller/Action/HelperBroker.php +++ b/library/Zend/Controller/Action/HelperBroker.php @@ -1,4 +1,5 @@ 'Zend/Controller/Action/Helper/', ]); @@ -167,8 +155,6 @@ public static function getExistingHelper($name) $stack = self::getStack(); if (!isset($stack->{$name})) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Action helper "' . $name . '" has not been registered with the helper broker'); } @@ -308,8 +294,6 @@ public function __call($method, $args) { $helper = $this->getHelper($method); if (!method_exists($helper, 'direct')) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Helper "' . $method . '" does not support overloading via direct()'); } @@ -354,16 +338,12 @@ protected static function _loadHelper($name) try { $class = self::getPluginLoader()->load($name); } catch (Zend_Loader_PluginLoader_Exception $e) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Action Helper by name ' . $name . ' not found', 0, $e); } $helper = new $class(); if (!$helper instanceof Zend_Controller_Action_Helper_Abstract) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Helper name ' . $name . ' -> class ' . $class . ' is not of type Zend_Controller_Action_Helper_Abstract'); } diff --git a/library/Zend/Controller/Action/HelperBroker/PriorityStack.php b/library/Zend/Controller/Action/HelperBroker/PriorityStack.php index 35ba50063..d8b955c34 100644 --- a/library/Zend/Controller/Action/HelperBroker/PriorityStack.php +++ b/library/Zend/Controller/Action/HelperBroker/PriorityStack.php @@ -1,4 +1,5 @@ offsetExists($priorityOrHelperName)) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('A helper with priority ' . $priorityOrHelperName . ' does not exist.'); } @@ -141,8 +140,6 @@ public function offsetSet($priority, $helper): Zend_Controller_Action_HelperBrok $priority = (int) $priority; if (!$helper instanceof Zend_Controller_Action_Helper_Abstract) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('$helper must extend Zend_Controller_Action_Helper_Abstract.'); } @@ -178,8 +175,6 @@ public function offsetSet($priority, $helper): Zend_Controller_Action_HelperBrok public function offsetUnset($priorityOrHelperName): Zend_Controller_Action_HelperBroker_PriorityStack { if (!$this->offsetExists($priorityOrHelperName)) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('A helper with priority or name ' . $priorityOrHelperName . ' does not exist.'); } diff --git a/library/Zend/Controller/Action/Interface.php b/library/Zend/Controller/Action/Interface.php index 7a9c3055c..a18b945bb 100644 --- a/library/Zend/Controller/Action/Interface.php +++ b/library/Zend/Controller/Action/Interface.php @@ -1,4 +1,5 @@ _pathDelimiter = $spec; @@ -242,7 +236,7 @@ protected function _formatName($unformatted, $isAction = false) { // preserve directories if (!$isAction) { - $segments = explode($this->getPathDelimiter(), $unformatted); + $segments = explode($this->getPathDelimiter(), $unformatted ?? ''); } else { $segments = (array) $unformatted; } @@ -264,7 +258,6 @@ protected function _formatName($unformatted, $isAction = false) public function getFrontController() { if (null === $this->_frontController) { - require_once 'Zend/Controller/Front.php'; $this->_frontController = Zend_Controller_Front::getInstance(); } diff --git a/library/Zend/Controller/Dispatcher/Exception.php b/library/Zend/Controller/Dispatcher/Exception.php index 366c9ac6c..5bb04dbb7 100644 --- a/library/Zend/Controller/Dispatcher/Exception.php +++ b/library/Zend/Controller/Dispatcher/Exception.php @@ -1,4 +1,5 @@ addControllerDirectory($path, $module); } } else { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Controller directory spec must be either a string or an array'); } @@ -242,8 +239,6 @@ public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Control if (!$this->isDispatchable($request)) { $controller = $request->getControllerName(); if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception('Invalid controller specified (' . $request->getControllerName() . ')'); } @@ -279,8 +274,6 @@ public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Control $controller = new $moduleClassName($request, $this->getResponse(), $this->getParams()); if (!($controller instanceof Zend_Controller_Action_Interface) && !($controller instanceof Zend_Controller_Action)) { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception( 'Controller "' . $moduleClassName . '" is not an instance of Zend_Controller_Action_Interface' ); @@ -353,14 +346,10 @@ public function loadClass($className) if (Zend_Loader::isReadable($loadFile)) { include_once $loadFile; } else { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception('Cannot load controller class "' . $className . '" from file "' . $loadFile . "'"); } if (!class_exists($finalClass, false)) { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception('Invalid controller class ("' . $finalClass . '")'); } @@ -398,8 +387,6 @@ public function getControllerClass(Zend_Controller_Request_Abstract $request) $this->_curModule = $this->_defaultModule; $this->_curDirectory = $controllerDirs[$this->_defaultModule]; } else { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('No default module defined for this application'); } diff --git a/library/Zend/Controller/Exception.php b/library/Zend/Controller/Exception.php index c85fb9f3f..21fa646ac 100644 --- a/library/Zend/Controller/Exception.php +++ b/library/Zend/Controller/Exception.php @@ -1,4 +1,5 @@ _router) { - require_once 'Zend/Controller/Router/Rewrite.php'; $this->setRouter(new Zend_Controller_Router_Rewrite()); } @@ -562,8 +551,6 @@ public function getRouter() public function setBaseUrl($base = null) { if (!is_string($base) && (null !== $base)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Rewrite base must be a string'); } @@ -614,7 +601,6 @@ public function getDispatcher() { // Instantiate the default dispatcher if one was not set. if (!$this->_dispatcher instanceof Zend_Controller_Dispatcher_Interface) { - require_once 'Zend/Controller/Dispatcher/Standard.php'; $this->_dispatcher = new Zend_Controller_Dispatcher_Standard(); } @@ -637,14 +623,11 @@ public function setResponse($response) { if (is_string($response)) { if (!class_exists($response)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($response); } $response = new $response(); } if (!$response instanceof Zend_Controller_Response_Abstract) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid response class'); } @@ -868,14 +851,12 @@ public function returnResponse($flag = null) */ public function dispatch(?Zend_Controller_Request_Abstract $request = null, ?Zend_Controller_Response_Abstract $response = null) { - if (!$this->getParam('noErrorHandler') && !$this->_plugins->hasPlugin(\Zend_Controller_Plugin_ErrorHandler::class)) { + if (!$this->getParam('noErrorHandler') && !$this->_plugins->hasPlugin(Zend_Controller_Plugin_ErrorHandler::class)) { // Register with stack index of 100 - require_once 'Zend/Controller/Plugin/ErrorHandler.php'; $this->_plugins->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(), 100); } if (!$this->getParam('noViewRenderer') && !Zend_Controller_Action_HelperBroker::hasHelper('viewRenderer')) { - require_once 'Zend/Controller/Action/Helper/ViewRenderer.php'; Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-80, new Zend_Controller_Action_Helper_ViewRenderer()); } @@ -883,7 +864,6 @@ public function dispatch(?Zend_Controller_Request_Abstract $request = null, ?Zen if (null !== $request) { $this->setRequest($request); } elseif ((null === $request) && (null === ($request = $this->getRequest()))) { - require_once 'Zend/Controller/Request/Http.php'; $request = new Zend_Controller_Request_Http(); $this->setRequest($request); } @@ -899,7 +879,6 @@ public function dispatch(?Zend_Controller_Request_Abstract $request = null, ?Zen if (null !== $response) { $this->setResponse($response); } elseif ((null === $this->_response) && (null === ($this->_response = $this->getResponse()))) { - require_once 'Zend/Controller/Response/Http.php'; $response = new Zend_Controller_Response_Http(); $this->setResponse($response); } diff --git a/library/Zend/Controller/Plugin/Abstract.php b/library/Zend/Controller/Plugin/Abstract.php index e038176ad..848728ee5 100644 --- a/library/Zend/Controller/Plugin/Abstract.php +++ b/library/Zend/Controller/Plugin/Abstract.php @@ -1,4 +1,5 @@ _saveStack($stack); if (!$next instanceof Zend_Controller_Request_Abstract) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('ArrayStack should only contain request objects'); } $action = $next->getActionName(); diff --git a/library/Zend/Controller/Plugin/Broker.php b/library/Zend/Controller/Plugin/Broker.php index caceaf0c0..0c52437d9 100644 --- a/library/Zend/Controller/Plugin/Broker.php +++ b/library/Zend/Controller/Plugin/Broker.php @@ -1,4 +1,5 @@ _plugins, true)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Plugin already registered'); } @@ -52,8 +50,6 @@ public function registerPlugin(Zend_Controller_Plugin_Abstract $plugin, $stackIn if ($stackIndex) { if (isset($this->_plugins[$stackIndex])) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Plugin with stackIndex "' . $stackIndex . '" already registered'); } $this->_plugins[$stackIndex] = $plugin; @@ -92,8 +88,6 @@ public function unregisterPlugin($plugin) // Given a plugin object, find it in the array $key = array_search($plugin, $this->_plugins, true); if (false === $key) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Plugin never registered.'); } unset($this->_plugins[$key]); diff --git a/library/Zend/Controller/Plugin/ErrorHandler.php b/library/Zend/Controller/Plugin/ErrorHandler.php index 2fabfb427..489b7a221 100644 --- a/library/Zend/Controller/Plugin/ErrorHandler.php +++ b/library/Zend/Controller/Plugin/ErrorHandler.php @@ -1,4 +1,5 @@ exception = $exception; switch ($exceptionType) { - case \Zend_Controller_Router_Exception::class: + case Zend_Controller_Router_Exception::class: if (404 == $exception->getCode()) { $error->type = self::EXCEPTION_NO_ROUTE; } else { @@ -265,11 +265,11 @@ protected function _handleError(Zend_Controller_Request_Abstract $request) } break; - case \Zend_Controller_Dispatcher_Exception::class: + case Zend_Controller_Dispatcher_Exception::class: $error->type = self::EXCEPTION_NO_CONTROLLER; break; - case \Zend_Controller_Action_Exception::class: + case Zend_Controller_Action_Exception::class: if (404 == $exception->getCode()) { $error->type = self::EXCEPTION_NO_ACTION; } else { diff --git a/library/Zend/Controller/Plugin/PutHandler.php b/library/Zend/Controller/Plugin/PutHandler.php index 7347a073f..ce6102c3c 100644 --- a/library/Zend/Controller/Plugin/PutHandler.php +++ b/library/Zend/Controller/Plugin/PutHandler.php @@ -1,4 +1,5 @@ setRequestUri($path); } else { - require_once 'Zend/Controller/Request/Exception.php'; - throw new Zend_Controller_Request_Exception('Invalid URI provided to constructor'); } } else { @@ -189,8 +186,6 @@ public function get($key) */ public function __set($key, $value) { - require_once 'Zend/Controller/Request/Exception.php'; - throw new Zend_Controller_Request_Exception('Setting values in superglobals not allowed; please use setParam()'); } @@ -255,8 +250,6 @@ public function has($key) public function setQuery($spec, $value = null) { if ((null === $value) && !is_array($spec)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid value passed to setQuery(); must be either array of values or key/value pair'); } if ((null === $value) && is_array($spec)) { @@ -303,8 +296,6 @@ public function getQuery($key = null, $default = null) public function setPost($spec, $value = null) { if ((null === $value) && !is_array($spec)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid value passed to setPost(); must be either array of values or key/value pair'); } if ((null === $value) && is_array($spec)) { @@ -1039,8 +1030,6 @@ public function getRawBody() public function getHeader($header) { if (empty($header)) { - require_once 'Zend/Controller/Request/Exception.php'; - throw new Zend_Controller_Request_Exception('An HTTP header name is required'); } diff --git a/library/Zend/Controller/Request/HttpTestCase.php b/library/Zend/Controller/Request/HttpTestCase.php index 11b6b4f65..b770ee1a4 100644 --- a/library/Zend/Controller/Request/HttpTestCase.php +++ b/library/Zend/Controller/Request/HttpTestCase.php @@ -1,4 +1,5 @@ _validMethodTypes)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid request method specified'); } $this->_method = $type; diff --git a/library/Zend/Controller/Request/Simple.php b/library/Zend/Controller/Request/Simple.php index e45621628..0bce2911a 100644 --- a/library/Zend/Controller/Request/Simple.php +++ b/library/Zend/Controller/Request/Simple.php @@ -1,4 +1,5 @@ $code) || (599 < $code)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid HTTP response code'); } @@ -335,8 +334,6 @@ public function canSendHeaders($throw = false) { $ok = headers_sent($file, $line); if ($ok && $throw && $this->headersSentThrowsException) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); } @@ -512,8 +509,6 @@ public function getBody($spec = false) public function append($name, $content) { if (!is_string($name)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid body segment key ("' . gettype($name) . '")'); } @@ -537,8 +532,6 @@ public function append($name, $content) public function prepend($name, $content) { if (!is_string($name)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid body segment key ("' . gettype($name) . '")'); } @@ -566,14 +559,10 @@ public function prepend($name, $content) public function insert($name, $content, $parent = null, $before = false) { if (!is_string($name)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid body segment key ("' . gettype($name) . '")'); } if ((null !== $parent) && !is_string($parent)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid body segment parent key ("' . gettype($parent) . '")'); } diff --git a/library/Zend/Controller/Response/Cli.php b/library/Zend/Controller/Response/Cli.php index c63f8d39a..04c6a3922 100644 --- a/library/Zend/Controller/Response/Cli.php +++ b/library/Zend/Controller/Response/Cli.php @@ -1,4 +1,5 @@ _frontController; } - require_once 'Zend/Controller/Front.php'; $this->_frontController = Zend_Controller_Front::getInstance(); return $this->_frontController; diff --git a/library/Zend/Controller/Router/Exception.php b/library/Zend/Controller/Router/Exception.php index 8675697b0..11282542e 100644 --- a/library/Zend/Controller/Router/Exception.php +++ b/library/Zend/Controller/Router/Exception.php @@ -1,4 +1,5 @@ getFrontController()->getDispatcher(); $request = $this->getFrontController()->getRequest(); - require_once 'Zend/Controller/Router/Route/Module.php'; $compat = new Zend_Controller_Router_Route_Module([], $dispatcher, $request); $this->_routes = ['default' => $compat] + $this->_routes; @@ -161,8 +159,6 @@ public function addConfig(Zend_Config $config, $section = null) { if ($section !== null) { if ($config->{$section} === null) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception("No route configuration in section '{$section}'"); } @@ -174,8 +170,6 @@ public function addConfig(Zend_Config $config, $section = null) if ($route instanceof Zend_Controller_Router_Route_Chain) { if (!isset($info->chain)) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('No chain defined'); } @@ -208,9 +202,8 @@ public function addConfig(Zend_Config $config, $section = null) */ protected function _getRouteFromConfig(Zend_Config $info) { - $class = $info->type ?? \Zend_Controller_Router_Route::class; + $class = $info->type ?? Zend_Controller_Router_Route::class; if (!class_exists($class)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($class); } @@ -273,8 +266,6 @@ protected function _addChainRoutesFromConfig( public function removeRoute($name) { if (!isset($this->_routes[$name])) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception("Route $name is not defined"); } @@ -317,8 +308,6 @@ public function hasRoute($name) public function getRoute($name) { if (!isset($this->_routes[$name])) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception("Route $name is not defined"); } @@ -333,8 +322,6 @@ public function getRoute($name) public function getCurrentRoute() { if (!isset($this->_currentRoute)) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('Current route is not defined'); } @@ -349,8 +336,6 @@ public function getCurrentRoute() public function getCurrentRouteName() { if (!isset($this->_currentRoute)) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('Current route is not defined'); } @@ -376,8 +361,6 @@ public function getRoutes() public function route(Zend_Controller_Request_Abstract $request) { if (!$request instanceof Zend_Controller_Request_Http) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception( 'Zend_Controller_Router_Rewrite requires a Zend_Controller_Request_Http-based request object' ); @@ -413,8 +396,6 @@ public function route(Zend_Controller_Request_Abstract $request) } if (!$routeMatched) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('No route matched the request', 404); } @@ -466,8 +447,6 @@ protected function _setRequestParams($request, $params) public function assemble($userParams, $name = null, $reset = false, $encode = true) { if (!is_array($userParams)) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('userParams must be an array'); } diff --git a/library/Zend/Controller/Router/Route.php b/library/Zend/Controller/Router/Route.php index 16219df5a..25ec32b3d 100644 --- a/library/Zend/Controller/Router/Route.php +++ b/library/Zend/Controller/Router/Route.php @@ -1,4 +1,5 @@ _urlDelimiter); $this->_defaults = (array) $defaults; $this->_requirements = (array) $reqs; - $this->_translator = $translator; $this->_locale = $locale; if ($route !== '') { @@ -180,12 +150,6 @@ public function __construct( if (substr($part, 0, 1) == $this->_urlVariable && substr($part, 1, 1) != $this->_urlVariable) { $name = substr($part, 1); - if (substr($name, 0, 1) === '@' && substr($name, 1, 1) !== '@') { - $name = substr($name, 1); - $this->_translatable[] = $name; - $this->_isTranslated = true; - } - $this->_parts[$pos] = ($reqs[$name] ?? $this->_defaultRegex); $this->_variables[$pos] = $name; } else { @@ -193,10 +157,6 @@ public function __construct( $part = substr($part, 1); } - if (substr($part, 0, 1) === '@' && substr($part, 1, 1) !== '@') { - $this->_isTranslated = true; - } - $this->_parts[$pos] = $part; if ($part !== '*') { @@ -218,10 +178,6 @@ public function __construct( */ public function match($path, $partial = false) { - if ($this->_isTranslated) { - $translateMessages = $this->getTranslator()->getMessages(); - } - $pathStaticCount = 0; $values = []; $matchedPath = ''; @@ -267,19 +223,6 @@ public function match($path, $partial = false) // Translate value if required $part = $this->_parts[$pos]; - if ($this->_isTranslated - && (substr($part, 0, 1) === '@' && substr($part, 1, 1) !== '@' - && $name === null) - || $name !== null && in_array($name, $this->_translatable) - ) { - if (substr($part, 0, 1) === '@') { - $part = substr($part, 1); - } - - if (($originalPathPart = array_search($pathPart, $translateMessages)) !== false) { - $pathPart = $originalPathPart; - } - } if (substr($part ?? '', 0, 2) === '@@') { $part = substr($part, 1); @@ -345,17 +288,6 @@ public function match($path, $partial = false) */ public function assemble($data = [], $reset = false, $encode = false, $partial = false) { - if ($this->_isTranslated) { - $translator = $this->getTranslator(); - - if (isset($data['@locale'])) { - $locale = $data['@locale']; - unset($data['@locale']); - } else { - $locale = $this->getLocale(); - } - } - $url = []; $flag = false; @@ -378,30 +310,16 @@ public function assemble($data = [], $reset = false, $encode = false, $partial = } elseif (array_key_exists($name, $this->_defaults)) { $value = $this->_defaults[$name]; } else { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception($name . ' is not specified'); } - if ($this->_isTranslated && in_array($name, $this->_translatable)) { - $url[$key] = $translator->translate($value, $locale); - } else { - $url[$key] = $value; - } + $url[$key] = $value; } elseif ($part != '*') { - if ($this->_isTranslated && substr($part, 0, 1) === '@') { - if (substr($part, 1, 1) !== '@') { - $url[$key] = $translator->translate(substr($part, 1), $locale); - } else { - $url[$key] = substr($part, 1); - } - } else { - if (substr($part, 0, 2) === '@@') { - $part = substr($part, 1); - } - - $url[$key] = $part; + if (substr($part, 0, 2) === '@@') { + $part = substr($part, 1); } + + $url[$key] = $part; } else { if (!$reset) { $data += $this->_wildcardData; @@ -424,12 +342,6 @@ public function assemble($data = [], $reset = false, $encode = false, $partial = if (isset($this->_variables[$key])) { $defaultValue = $this->getDefault($this->_variables[$key]); - - if ($this->_isTranslated && $defaultValue !== null - && isset($this->_translatable[$this->_variables[$key]]) - ) { - $defaultValue = $translator->translate($defaultValue, $locale); - } } if ($flag || $value !== $defaultValue || $partial) { @@ -480,61 +392,6 @@ public function getVariables() return $this->_variables; } - /** - * Set a default translator. - */ - public static function setDefaultTranslator(?Zend_Translate $translator = null) - { - self::$_defaultTranslator = $translator; - } - - /** - * Get the default translator. - * - * @return Zend_Translate - */ - public static function getDefaultTranslator() - { - return self::$_defaultTranslator; - } - - /** - * Set a translator. - */ - public function setTranslator(Zend_Translate $translator) - { - $this->_translator = $translator; - } - - /** - * Get the translator. - * - * @return Zend_Translate - */ - public function getTranslator() - { - if ($this->_translator !== null) { - return $this->_translator; - } - if (($translator = self::getDefaultTranslator()) !== null) { - return $translator; - } - - try { - $translator = Zend_Registry::get(\Zend_Translate::class); - } catch (Zend_Exception $e) { - $translator = null; - } - - if ($translator instanceof Zend_Translate) { - return $translator; - } - - require_once 'Zend/Controller/Router/Exception.php'; - - throw new Zend_Controller_Router_Exception('Could not find a translator'); - } - /** * Set a default locale. * @@ -580,7 +437,7 @@ public function getLocale() } try { - $locale = Zend_Registry::get(\Zend_Locale::class); + $locale = Zend_Registry::get(Zend_Locale::class); } catch (Zend_Exception $e) { $locale = null; } diff --git a/library/Zend/Controller/Router/Route/Abstract.php b/library/Zend/Controller/Router/Route/Abstract.php index c7549e2b6..ab0f4f125 100644 --- a/library/Zend/Controller/Router/Route/Abstract.php +++ b/library/Zend/Controller/Router/Route/Abstract.php @@ -1,4 +1,5 @@ chain($this)->chain($route, $separator); diff --git a/library/Zend/Controller/Router/Route/Chain.php b/library/Zend/Controller/Router/Route/Chain.php index b8728d31b..f423b7eae 100644 --- a/library/Zend/Controller/Router/Route/Chain.php +++ b/library/Zend/Controller/Router/Route/Chain.php @@ -1,4 +1,5 @@ _request === null) { - require_once 'Zend/Controller/Front.php'; $this->_request = Zend_Controller_Front::getInstance()->getRequest(); } @@ -296,8 +295,6 @@ public function assemble($data = [], $reset = false, $encode = false, $partial = } elseif (isset($this->_defaults[$name])) { $host[$key] = $this->_defaults[$name]; } else { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception($name . ' is not specified'); } } else { diff --git a/library/Zend/Controller/Router/Route/Interface.php b/library/Zend/Controller/Router/Route/Interface.php index f57e4f296..2e44b2756 100644 --- a/library/Zend/Controller/Router/Route/Interface.php +++ b/library/Zend/Controller/Router/Route/Interface.php @@ -1,4 +1,5 @@ _reverse === null) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('Cannot assemble. Reversed route is not specified.'); } @@ -247,8 +245,6 @@ public function assemble($data = [], $reset = false, $encode = false, $partial = $return = $mergedData ? @vsprintf($this->_reverse, $mergedData) : $this->_reverse; if ($return === false) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('Cannot assemble. Too few arguments?'); } diff --git a/library/Zend/Controller/Router/Route/Static.php b/library/Zend/Controller/Router/Route/Static.php index 51af912bf..934ed3403 100644 --- a/library/Zend/Controller/Router/Route/Static.php +++ b/library/Zend/Controller/Router/Route/Static.php @@ -1,4 +1,5 @@ 'iso', // format for date strings 'iso' or 'php' - 'fix_dst' => true, // fix dst on summer/winter time change - 'extend_month' => false, // false - addMonth like SQL, true like excel - 'cache' => null, // cache to set - 'timesync' => null, // timesync server to set - ]; - - // Class wide Date Constants - public const DAY = 'dd'; - public const DAY_SHORT = 'd'; - public const DAY_SUFFIX = 'SS'; - public const DAY_OF_YEAR = 'D'; - public const WEEKDAY = 'EEEE'; - public const WEEKDAY_SHORT = 'EEE'; - public const WEEKDAY_NARROW = 'E'; - public const WEEKDAY_NAME = 'EE'; - public const WEEKDAY_8601 = 'eee'; - public const WEEKDAY_DIGIT = 'e'; - public const WEEK = 'ww'; - public const MONTH = 'MM'; - public const MONTH_SHORT = 'M'; - public const MONTH_DAYS = 'ddd'; - public const MONTH_NAME = 'MMMM'; - public const MONTH_NAME_SHORT = 'MMM'; - public const MONTH_NAME_NARROW = 'MMMMM'; - public const YEAR = 'y'; - public const YEAR_SHORT = 'yy'; - public const YEAR_8601 = 'Y'; - public const YEAR_SHORT_8601 = 'YY'; - public const LEAPYEAR = 'l'; - public const MERIDIEM = 'a'; - public const SWATCH = 'B'; - public const HOUR = 'HH'; - public const HOUR_SHORT = 'H'; - public const HOUR_AM = 'hh'; - public const HOUR_SHORT_AM = 'h'; - public const MINUTE = 'mm'; - public const MINUTE_SHORT = 'm'; - public const SECOND = 'ss'; - public const SECOND_SHORT = 's'; - public const MILLISECOND = 'S'; - public const TIMEZONE_NAME = 'zzzz'; - public const DAYLIGHT = 'I'; - public const GMT_DIFF = 'Z'; - public const GMT_DIFF_SEP = 'ZZZZ'; - public const TIMEZONE = 'z'; - public const TIMEZONE_SECS = 'X'; - public const ISO_8601 = 'c'; - public const RFC_2822 = 'r'; - public const TIMESTAMP = 'U'; - public const ERA = 'G'; - public const ERA_NAME = 'GGGG'; - public const ERA_NARROW = 'GGGGG'; - public const DATES = 'F'; - public const DATE_FULL = 'FFFFF'; - public const DATE_LONG = 'FFFF'; - public const DATE_MEDIUM = 'FFF'; - public const DATE_SHORT = 'FF'; - public const TIMES = 'WW'; - public const TIME_FULL = 'TTTTT'; - public const TIME_LONG = 'TTTT'; - public const TIME_MEDIUM = 'TTT'; - public const TIME_SHORT = 'TT'; - public const DATETIME = 'K'; - public const DATETIME_FULL = 'KKKKK'; - public const DATETIME_LONG = 'KKKK'; - public const DATETIME_MEDIUM = 'KKK'; - public const DATETIME_SHORT = 'KK'; - public const ATOM = 'OOO'; - public const COOKIE = 'CCC'; - public const RFC_822 = 'R'; - public const RFC_850 = 'RR'; - public const RFC_1036 = 'RRR'; - public const RFC_1123 = 'RRRR'; - public const RFC_3339 = 'RRRRR'; - public const RSS = 'SSS'; - public const W3C = 'WWW'; - - /** - * Generates the standard date object, could be a unix timestamp, localized date, - * string, integer, array and so on. Also parts of dates or time are supported - * Always set the default timezone: http://php.net/date_default_timezone_set - * For example, in your bootstrap: date_default_timezone_set('America/Los_Angeles'); - * For detailed instructions please look in the docu. - * - * @param array|int|string|Zend_Date $date OPTIONAL Date value or value of date part to set - * ,depending on $part. If null the actual time is set - * @param string $part OPTIONAL Defines the input format of $date - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function __construct($date = null, $part = null, $locale = null) - { - if (is_object($date) and !($date instanceof Zend_TimeSync_Protocol) - and !($date instanceof Zend_Date)) { - if ($locale instanceof Zend_Locale) { - $locale = $date; - $date = null; - $part = null; - } else { - $date = (string) $date; - } - } - - if (($date !== null) and !is_array($date) and !($date instanceof Zend_TimeSync_Protocol) - and !($date instanceof Zend_Date) and !defined($date) and Zend_Locale::isLocale($date, true, false)) { - $locale = $date; - $date = null; - $part = null; - } elseif (($part !== null) and !defined($part) and Zend_Locale::isLocale($part, true, false)) { - $locale = $part; - $part = null; - } - - $this->setLocale($locale); - if (is_string($date) && ($part === null) && (strlen($date) <= 5)) { - $part = $date; - $date = null; - } - - if ($date === null) { - if ($part === null) { - $date = time(); - } elseif ($part !== self::TIMESTAMP) { - $date = self::now($locale); - $date = $date->get($part); - } - } - - if ($date instanceof Zend_TimeSync_Protocol) { - $date = $date->getInfo(); - $date = $this->_getTime($date['offset']); - $part = null; - } elseif (parent::$_defaultOffset != 0) { - $date = $this->_getTime(parent::$_defaultOffset); - } - - // set the timezone and offset for $this - $zone = @date_default_timezone_get(); - $this->setTimezone($zone); - - // try to get timezone from date-string - if (!is_int($date)) { - $zone = $this->getTimezoneFromString($date); - $this->setTimezone($zone); - } - - // set datepart - if (($part !== null && $part !== self::TIMESTAMP) or (!is_numeric($date))) { - // switch off dst handling for value setting - $this->setUnixTimestamp($this->getGmtOffset()); - $this->set($date, $part, $this->_locale); - - // DST fix - if (is_array($date) === true) { - if (!isset($date['hour'])) { - $date['hour'] = 0; - } - - $hour = $this->toString('H', 'iso', true); - $hour = $date['hour'] - $hour; - switch ($hour) { - case 1: - case -23: - $this->addTimestamp(3600); - - break; - case -1: - case 23: - $this->subTimestamp(3600); - - break; - case 2: - case -22: - $this->addTimestamp(7200); - - break; - case -2: - case 22: - $this->subTimestamp(7200); - - break; - } - } - } else { - $this->setUnixTimestamp($date); - } - } - - /** - * Sets class wide options, if no option was given, the actual set options will be returned. - * - * @param array $options Options to set - * - * @return Options array if no option was given - */ - public static function setOptions(array $options = []) - { - if (empty($options)) { - return self::$_options; - } - - foreach ($options as $name => $value) { - $name = strtolower($name); - - if (array_key_exists($name, self::$_options)) { - switch ($name) { - case 'format_type': - if ((strtolower($value) != 'php') && (strtolower($value) != 'iso')) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("Unknown format type ($value) for dates, only 'iso' and 'php' supported", 0, null, $value); - } - - break; - case 'fix_dst': - if (!is_bool($value)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("'fix_dst' has to be boolean", 0, null, $value); - } - - break; - case 'extend_month': - if (!is_bool($value)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("'extend_month' has to be boolean", 0, null, $value); - } - - break; - case 'cache': - if ($value === null) { - parent::$_cache = null; - } else { - if (!$value instanceof Zend_Cache_Core) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('Instance of Zend_Cache expected'); - } - - parent::$_cache = $value; - parent::$_cacheTags = Zend_Date_DateObject::_getTagSupportForCache(); - Zend_Locale_Data::setCache($value); - } - - break; - case 'timesync': - if ($value === null) { - parent::$_defaultOffset = 0; - } else { - if (!$value instanceof Zend_TimeSync_Protocol) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('Instance of Zend_TimeSync expected'); - } - - $date = $value->getInfo(); - parent::$_defaultOffset = $date['offset']; - } - - break; - } - self::$_options[$name] = $value; - } else { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("Unknown option: $name = $value"); - } - } - } - - /** - * Returns this object's internal UNIX timestamp (equivalent to Zend_Date::TIMESTAMP). - * If the timestamp is too large for integers, then the return value will be a string. - * This function does not return the timestamp as an object. - * Use clone() or copyPart() instead. - * - * @return int|string UNIX timestamp - */ - public function getTimestamp() - { - return $this->getUnixTimestamp(); - } - - /** - * Returns the calculated timestamp - * HINT: timestamps are always GMT. - * - * @param string $calc Type of calculation to make - * @param array|int|string|Zend_Date $stamp Timestamp to calculate, when null the actual timestamp is calculated - * - * @return int|Zend_Date - */ - private function _timestamp($calc, $stamp) - { - if ($stamp instanceof Zend_Date) { - // extract timestamp from object - $stamp = $stamp->getTimestamp(); - } - - if (is_array($stamp)) { - if (isset($stamp['timestamp']) === true) { - $stamp = $stamp['timestamp']; - } else { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('no timestamp given in array'); - } - } - - if ($calc === 'set') { - $return = $this->setUnixTimestamp($stamp); - } else { - $return = $this->_calcdetail($calc, $stamp, self::TIMESTAMP, null); - } - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new timestamp. - * - * @param array|int|string|Zend_Date $timestamp Timestamp to set - * - * @return Zend_Date Provides a fluent interface - */ - public function setTimestamp($timestamp) - { - return $this->_timestamp('set', $timestamp); - } - - /** - * Adds a timestamp. - * - * @param array|int|string|Zend_Date $timestamp Timestamp to add - * - * @return Zend_Date Provides a fluent interface - */ - public function addTimestamp($timestamp) - { - return $this->_timestamp('add', $timestamp); - } - - /** - * Subtracts a timestamp. - * - * @param array|int|string|Zend_Date $timestamp Timestamp to sub - * - * @return Zend_Date Provides a fluent interface - */ - public function subTimestamp($timestamp) - { - return $this->_timestamp('sub', $timestamp); - } - - /** - * Compares two timestamps, returning the difference as integer. - * - * @param array|int|string|Zend_Date $timestamp Timestamp to compare - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareTimestamp($timestamp) - { - return $this->_timestamp('cmp', $timestamp); - } - - /** - * Returns a string representation of the object - * Supported format tokens are: - * G - era, y - year, Y - ISO year, M - month, w - week of year, D - day of year, d - day of month - * E - day of week, e - number of weekday (1-7), h - hour 1-12, H - hour 0-23, m - minute, s - second - * A - milliseconds of day, z - timezone, Z - timezone offset, S - fractional second, a - period of day. - * - * Additionally format tokens but non ISO conform are: - * SS - day suffix, eee - php number of weekday(0-6), ddd - number of days per month - * l - Leap year, B - swatch internet time, I - daylight saving time, X - timezone offset in seconds - * r - RFC2822 format, U - unix timestamp - * - * Not supported ISO tokens are - * u - extended year, Q - quarter, q - quarter, L - stand alone month, W - week of month - * F - day of week of month, g - modified julian, c - stand alone weekday, k - hour 0-11, K - hour 1-24 - * v - wall zone - * - * @param string $format OPTIONAL Rule for formatting output. If null the default date format is used - * @param string $type OPTIONAL Type for the format string which overrides the standard setting - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return string - */ - public function toString($format = null, $type = null, $locale = null) - { - if (is_object($format)) { - if ($format instanceof Zend_Locale) { - $locale = $format; - $format = null; - } else { - $format = (string) $format; - } - } - - if (is_object($type)) { - if ($type instanceof Zend_Locale) { - $locale = $type; - $type = null; - } else { - $type = (string) $type; - } - } - - if (($format !== null) && !defined($format) - && ($format != 'ee') && ($format != 'ss') && ($format != 'GG') && ($format != 'MM') && ($format != 'EE') && ($format != 'TT') - && Zend_Locale::isLocale($format, null, false)) { - $locale = $format; - $format = null; - } - - if (($type !== null) and ($type != 'php') and ($type != 'iso') - and Zend_Locale::isLocale($type, null, false)) { - $locale = $type; - $type = null; - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($format === null) { - $format = Zend_Locale_Format::getDateFormat($locale) . ' ' . Zend_Locale_Format::getTimeFormat($locale); - } elseif (((self::$_options['format_type'] == 'php') && ($type === null)) or ($type == 'php')) { - $format = Zend_Locale_Format::convertPhpToIsoFormat($format); - } - - return $this->date($this->_toToken($format, $locale), $this->getUnixTimestamp(), false); - } - - /** - * Returns a string representation of the date which is equal with the timestamp. - * - * @return string - */ - public function __toString() - { - return $this->toString(null, $this->_locale); - } - - /** - * Returns a integer representation of the object - * But returns false when the given part is no value f.e. Month-Name. - * - * @param int|string|Zend_Date $part OPTIONAL Defines the date or datepart to return as integer - * - * @return false|int - */ - public function toValue($part = null) - { - $result = $this->get($part); - if (is_numeric($result)) { - return intval("$result"); - } - - return false; - } - - /** - * Returns an array representation of the object. - * - * @return array - */ - public function toArray() - { - return ['day' => $this->toString(self::DAY_SHORT, 'iso'), - 'month' => $this->toString(self::MONTH_SHORT, 'iso'), - 'year' => $this->toString(self::YEAR, 'iso'), - 'hour' => $this->toString(self::HOUR_SHORT, 'iso'), - 'minute' => $this->toString(self::MINUTE_SHORT, 'iso'), - 'second' => $this->toString(self::SECOND_SHORT, 'iso'), - 'timezone' => $this->toString(self::TIMEZONE, 'iso'), - 'timestamp' => $this->toString(self::TIMESTAMP, 'iso'), - 'weekday' => $this->toString(self::WEEKDAY_8601, 'iso'), - 'dayofyear' => $this->toString(self::DAY_OF_YEAR, 'iso'), - 'week' => $this->toString(self::WEEK, 'iso'), - 'gmtsecs' => $this->toString(self::TIMEZONE_SECS, 'iso'), ]; - } - - /** - * Returns a representation of a date or datepart - * This could be for example a localized monthname, the time without date, - * the era or only the fractional seconds. There are about 50 different supported date parts. - * For a complete list of supported datepart values look into the docu. - * - * @param string $part OPTIONAL Part of the date to return, if null the timestamp is returned - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return string date or datepart - */ - public function get($part = null, $locale = null) - { - if ($locale === null) { - $locale = $this->getLocale(); - } - - if (($part !== null) && !defined($part) - && ($part != 'ee') && ($part != 'ss') && ($part != 'GG') && ($part != 'MM') && ($part != 'EE') && ($part != 'TT') - && Zend_Locale::isLocale($part, null, false)) { - $locale = $part; - $part = null; - } - - if ($part === null) { - $part = self::TIMESTAMP; - } elseif (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - return $this->date($this->_toToken($part, $locale), $this->getUnixTimestamp(), false); - } - - /** - * Internal method to apply tokens. - * - * @param string $part - * @param string $locale - * - * @return string - */ - private function _toToken($part, $locale) - { - // get format tokens - $comment = false; - $format = ''; - $orig = ''; - for ($i = 0; isset($part[$i]); ++$i) { - if ($part[$i] == "'") { - $comment = $comment ? false : true; - if (isset($part[$i + 1]) && ($part[$i + 1] == "'")) { - $comment = $comment ? false : true; - $format .= "\\'"; - ++$i; - } - - $orig = ''; - - continue; - } - - if ($comment) { - $format .= '\\' . $part[$i]; - $orig = ''; - } else { - $orig .= $part[$i]; - if (!isset($part[$i + 1]) || (isset($orig[0]) && ($orig[0] != $part[$i + 1]))) { - $format .= $this->_parseIsoToDate($orig, $locale); - $orig = ''; - } - } - } - - return $format; - } - - /** - * Internal parsing method. - * - * @param string $token - * @param string $locale - * - * @return string - */ - private function _parseIsoToDate($token, $locale) - { - switch ($token) { - case self::DAY: - return 'd'; - - break; - - case self::WEEKDAY_SHORT: - $weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false)); - $day = Zend_Locale_Data::getContent($locale, 'day', ['gregorian', 'format', 'wide', $weekday]); - - return $this->_toComment(iconv_substr($day, 0, 3, 'UTF-8')); - - break; - - case self::DAY_SHORT: - return 'j'; - - break; - - case self::WEEKDAY: - $weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false)); - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'day', ['gregorian', 'format', 'wide', $weekday])); - - break; - - case self::WEEKDAY_8601: - return 'N'; - - break; - - case 'ee': - return $this->_toComment(str_pad($this->date('N', $this->getUnixTimestamp(), false), 2, '0', STR_PAD_LEFT)); - - break; - - case self::DAY_SUFFIX: - return 'S'; - - break; - - case self::WEEKDAY_DIGIT: - return 'w'; - - break; - - case self::DAY_OF_YEAR: - return 'z'; - - break; - - case 'DDD': - return $this->_toComment(str_pad($this->date('z', $this->getUnixTimestamp(), false), 3, '0', STR_PAD_LEFT)); - - break; - - case 'DD': - return $this->_toComment(str_pad($this->date('z', $this->getUnixTimestamp(), false), 2, '0', STR_PAD_LEFT)); - - break; - - case self::WEEKDAY_NARROW: - case 'EEEEE': - $weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false)); - $day = Zend_Locale_Data::getContent($locale, 'day', ['gregorian', 'format', 'abbreviated', $weekday]); - - return $this->_toComment(iconv_substr($day, 0, 1, 'UTF-8')); - - break; - - case self::WEEKDAY_NAME: - $weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false)); - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'day', ['gregorian', 'format', 'abbreviated', $weekday])); - - break; - - case 'w': - $week = $this->date('W', $this->getUnixTimestamp(), false); - - return $this->_toComment(($week[0] == '0') ? $week[1] : $week); - - break; - - case self::WEEK: - return 'W'; - - break; - - case self::MONTH_NAME: - $month = $this->date('n', $this->getUnixTimestamp(), false); - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'month', ['gregorian', 'format', 'wide', $month])); - - break; - - case self::MONTH: - return 'm'; - - break; - - case self::MONTH_NAME_SHORT: - $month = $this->date('n', $this->getUnixTimestamp(), false); - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'month', ['gregorian', 'format', 'abbreviated', $month])); - - break; - - case self::MONTH_SHORT: - return 'n'; - - break; - - case self::MONTH_DAYS: - return 't'; - - break; - - case self::MONTH_NAME_NARROW: - $month = $this->date('n', $this->getUnixTimestamp(), false); - $mon = Zend_Locale_Data::getContent($locale, 'month', ['gregorian', 'format', 'abbreviated', $month]); - - return $this->_toComment(iconv_substr($mon, 0, 1, 'UTF-8')); - - break; - - case self::LEAPYEAR: - return 'L'; - - break; - - case self::YEAR_8601: - return 'o'; - - break; - - case self::YEAR: - return 'Y'; - - break; - - case self::YEAR_SHORT: - return 'y'; - - break; - - case self::YEAR_SHORT_8601: - return $this->_toComment(substr($this->date('o', $this->getUnixTimestamp(), false), -2, 2)); - - break; - - case self::MERIDIEM: - $am = $this->date('a', $this->getUnixTimestamp(), false); - if ($am == 'am') { - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'am')); - } - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'pm')); - - break; - - case self::SWATCH: - return 'B'; - - break; - - case self::HOUR_SHORT_AM: - return 'g'; - - break; - - case self::HOUR_SHORT: - return 'G'; - - break; - - case self::HOUR_AM: - return 'h'; - - break; - - case self::HOUR: - return 'H'; - - break; - - case self::MINUTE: - return $this->_toComment(str_pad($this->date('i', $this->getUnixTimestamp(), false), 2, '0', STR_PAD_LEFT)); - - break; - - case self::SECOND: - return $this->_toComment(str_pad($this->date('s', $this->getUnixTimestamp(), false), 2, '0', STR_PAD_LEFT)); - - break; - - case self::MINUTE_SHORT: - return 'i'; - - break; - - case self::SECOND_SHORT: - return 's'; - - break; - - case self::MILLISECOND: - return $this->_toComment($this->getMilliSecond()); - - break; - - case self::TIMEZONE_NAME: - case 'vvvv': - return 'e'; - - break; - - case self::DAYLIGHT: - return 'I'; - - break; - - case self::GMT_DIFF: - case 'ZZ': - case 'ZZZ': - return 'O'; - - break; - - case self::GMT_DIFF_SEP: - return 'P'; - - break; - - case self::TIMEZONE: - case 'v': - case 'zz': - case 'zzz': - return 'T'; - - break; - - case self::TIMEZONE_SECS: - return 'Z'; - - break; - - case self::ISO_8601: - return 'c'; - - break; - - case self::RFC_2822: - return 'r'; - - break; - - case self::TIMESTAMP: - return 'U'; - - break; - - case self::ERA: - case 'GG': - case 'GGG': - $year = $this->date('Y', $this->getUnixTimestamp(), false); - if ($year < 0) { - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Abbr', '0'])); - } - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Abbr', '1'])); - - break; - - case self::ERA_NARROW: - $year = $this->date('Y', $this->getUnixTimestamp(), false); - if ($year < 0) { - return $this->_toComment(iconv_substr(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Abbr', '0']), 0, 1, 'UTF-8')) . '.'; - } - - return $this->_toComment(iconv_substr(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Abbr', '1']), 0, 1, 'UTF-8')) . '.'; - - break; - - case self::ERA_NAME: - $year = $this->date('Y', $this->getUnixTimestamp(), false); - if ($year < 0) { - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Names', '0'])); - } - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Names', '1'])); - - break; - - case self::DATES: - return $this->_toToken(Zend_Locale_Format::getDateFormat($locale), $locale); - - break; - - case self::DATE_FULL: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'full']), $locale); - - break; - - case self::DATE_LONG: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'long']), $locale); - - break; - - case self::DATE_MEDIUM: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'medium']), $locale); - - break; - - case self::DATE_SHORT: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'short']), $locale); - - break; - - case self::TIMES: - return $this->_toToken(Zend_Locale_Format::getTimeFormat($locale), $locale); - - break; - - case self::TIME_FULL: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'time', 'full'), $locale); - - break; - - case self::TIME_LONG: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'time', 'long'), $locale); - - break; - - case self::TIME_MEDIUM: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'time', 'medium'), $locale); - - break; - - case self::TIME_SHORT: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'time', 'short'), $locale); - - break; - - case self::DATETIME: - return $this->_toToken(Zend_Locale_Format::getDateTimeFormat($locale), $locale); - - break; - - case self::DATETIME_FULL: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'full']), $locale); - - break; - - case self::DATETIME_LONG: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'long']), $locale); - - break; - - case self::DATETIME_MEDIUM: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'medium']), $locale); - - break; - - case self::DATETIME_SHORT: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'short']), $locale); - - break; - - case self::ATOM: - return 'Y\-m\-d\TH\:i\:sP'; - - break; - - case self::COOKIE: - return 'l\, d\-M\-y H\:i\:s e'; - - break; - - case self::RFC_822: - return 'D\, d M y H\:i\:s O'; - - break; - - case self::RFC_850: - return 'l\, d\-M\-y H\:i\:s e'; - - break; - - case self::RFC_1036: - return 'D\, d M y H\:i\:s O'; - - break; - - case self::RFC_1123: - return 'D\, d M Y H\:i\:s O'; - - break; - - case self::RFC_3339: - return 'Y\-m\-d\TH\:i\:sP'; - - break; - - case self::RSS: - return 'D\, d M Y H\:i\:s O'; - - break; - - case self::W3C: - return 'Y\-m\-d\TH\:i\:sP'; - - break; - } - - if ($token == '') { - return ''; - } - - switch ($token[0]) { - case 'y': - if ((strlen($token) == 4) && (abs($this->getUnixTimestamp()) <= 0x7FFFFFFF)) { - return 'Y'; - } - - $length = iconv_strlen($token, 'UTF-8'); - - return $this->_toComment(str_pad($this->date('Y', $this->getUnixTimestamp(), false), $length, '0', STR_PAD_LEFT)); - - break; - - case 'Y': - if ((strlen($token) == 4) && (abs($this->getUnixTimestamp()) <= 0x7FFFFFFF)) { - return 'o'; - } - - $length = iconv_strlen($token, 'UTF-8'); - - return $this->_toComment(str_pad($this->date('o', $this->getUnixTimestamp(), false), $length, '0', STR_PAD_LEFT)); - - break; - - case 'A': - $length = iconv_strlen($token, 'UTF-8'); - $result = substr($this->getMilliSecond(), 0, 3); - $result += $this->date('s', $this->getUnixTimestamp(), false) * 1000; - $result += $this->date('i', $this->getUnixTimestamp(), false) * 60000; - $result += $this->date('H', $this->getUnixTimestamp(), false) * 3_600_000; - - return $this->_toComment(str_pad($result, $length, '0', STR_PAD_LEFT)); - - break; - } - - return $this->_toComment($token); - } - - /** - * Private function to make a comment of a token. - * - * @param string $token - * - * @return string - */ - private function _toComment($token) - { - $token = str_split($token); - $result = ''; - foreach ($token as $tok) { - $result .= '\\' . $tok; - } - - return $result; - } - - /** - * Return digit from standard names (english) - * Faster implementation than locale aware searching. - * - * @param string $name - * - * @return int Number of this month - */ - private function _getDigitFromName($name) - { - switch ($name) { - case 'Jan': - return 1; - - case 'Feb': - return 2; - - case 'Mar': - return 3; - - case 'Apr': - return 4; - - case 'May': - return 5; - - case 'Jun': - return 6; - - case 'Jul': - return 7; - - case 'Aug': - return 8; - - case 'Sep': - return 9; - - case 'Oct': - return 10; - - case 'Nov': - return 11; - - case 'Dec': - return 12; - - default: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('Month ($name) is not a known month'); - } - } - - /** - * Counts the exact year number - * < 70 - 2000 added, >70 < 100 - 1900, others just returned. - * - * @param int $value year number - * - * @return int Number of year - */ - public static function getFullYear($value) - { - if ($value >= 0) { - if ($value < 70) { - $value += 2000; - } elseif ($value < 100) { - $value += 1900; - } - } - - return $value; - } - - /** - * Sets the given date as new date or a given datepart as new datepart returning the new datepart - * This could be for example a localized dayname, the date without time, - * the month or only the seconds. There are about 50 different supported date parts. - * For a complete list of supported datepart values look into the docu. - * - * @param array|int|string|Zend_Date $date Date or datepart to set - * @param string $part OPTIONAL Part of the date to set, if null the timestamp is set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function set($date, $part = null, $locale = null) - { - if (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - $zone = $this->getTimezoneFromString($date); - $this->setTimezone($zone); - - $this->_calculate('set', $date, $part, $locale); - - return $this; - } - - /** - * Adds a date or datepart to the existing date, by extracting $part from $date, - * and modifying this object by adding that part. The $part is then extracted from - * this object and returned as an integer or numeric string (for large values, or $part's - * corresponding to pre-defined formatted date strings). - * This could be for example a ISO 8601 date, the hour the monthname or only the minute. - * There are about 50 different supported date parts. - * For a complete list of supported datepart values look into the docu. - * - * @param array|int|string|Zend_Date $date Date or datepart to add - * @param string $part OPTIONAL Part of the date to add, if null the timestamp is added - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function add($date, $part = self::TIMESTAMP, $locale = null) - { - if (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - $this->_calculate('add', $date, $part, $locale); - - return $this; - } - - /** - * Subtracts a date from another date. - * This could be for example a RFC2822 date, the time, - * the year or only the timestamp. There are about 50 different supported date parts. - * For a complete list of supported datepart values look into the docu - * Be aware: Adding -2 Months is not equal to Subtracting 2 Months !!! - * - * @param array|int|string|Zend_Date $date Date or datepart to subtract - * @param string $part OPTIONAL Part of the date to sub, if null the timestamp is subtracted - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function sub($date, $part = self::TIMESTAMP, $locale = null) - { - if (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - $this->_calculate('sub', $date, $part, $locale); - - return $this; - } - - /** - * Compares a date or datepart with the existing one. - * Returns -1 if earlier, 0 if equal and 1 if later. - * - * @param array|int|string|Zend_Date $date Date or datepart to compare with the date object - * @param string $part OPTIONAL Part of the date to compare, if null the timestamp is subtracted - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compare($date, $part = self::TIMESTAMP, $locale = null) - { - if (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - $compare = $this->_calculate('cmp', $date, $part, $locale); - - if ($compare > 0) { - return 1; - } - if ($compare < 0) { - return -1; - } - - return 0; - } - - /** - * Returns a new instance of Zend_Date with the selected part copied. - * To make an exact copy, use PHP's clone keyword. - * For a complete list of supported date part values look into the docu. - * If a date part is copied, all other date parts are set to standard values. - * For example: If only YEAR is copied, the returned date object is equal to - * 01-01-YEAR 00:00:00 (01-01-1970 00:00:00 is equal to timestamp 0) - * If only HOUR is copied, the returned date object is equal to - * 01-01-1970 HOUR:00:00 (so $this contains a timestamp equal to a timestamp of 0 plus HOUR). - * - * @param string $part Part of the date to compare, if null the timestamp is subtracted - * @param string|Zend_Locale $locale OPTIONAL New object's locale. No adjustments to timezone are made. - * - * @return Zend_Date New clone with requested part - */ - public function copyPart($part, $locale = null) - { - $clone = clone $this; // copy all instance variables - $clone->setUnixTimestamp(0); // except the timestamp - if ($locale != null) { - $clone->setLocale($locale); // set an other locale if selected - } - $clone->set($this, $part); - - return $clone; - } - - /** - * Internal function, returns the offset of a given timezone. - * - * @param string $zone - * - * @return int - */ - public function getTimezoneFromString($zone) - { - if (is_array($zone)) { - return $this->getTimezone(); - } - - if ($zone instanceof Zend_Date) { - return $zone->getTimezone(); - } - - $match = []; - preg_match('/\dZ$/', $zone, $match); - if (!empty($match)) { - return 'Etc/UTC'; - } - - preg_match('/([+-]\d{2}):{0,1}\d{2}/', $zone, $match); - if (!empty($match) and ($match[count($match) - 1] <= 14) and ($match[count($match) - 1] >= -12)) { - $zone = 'Etc/GMT'; - $zone .= ($match[count($match) - 1] < 0) ? '+' : '-'; - $zone .= (int) abs($match[count($match) - 1]); - - return $zone; - } - - preg_match('/([[:alpha:]\/_]{3,30})(?!.*([[:alpha:]\/]{3,30}))/', $zone, $match); - - try { - if (!empty($match) and (!is_int($match[count($match) - 1]))) { - $oldzone = $this->getTimezone(); - $this->setTimezone($match[count($match) - 1]); - $result = $this->getTimezone(); - $this->setTimezone($oldzone); - if ($result !== $oldzone) { - return $match[count($match) - 1]; - } - } - } catch (Exception $e) { - // fall through - } - - return $this->getTimezone(); - } - - /** - * Calculates the date or object. - * - * @param string $calc Calculation to make - * @param int|string $date Date for calculation - * @param int|string $comp Second date for calculation - * @param bool|int $dst Use dst correction if option is set - * - * @return int|string|Zend_Date new timestamp or Zend_Date depending on calculation - */ - private function _assign($calc, $date, $comp = 0, $dst = false) - { - switch ($calc) { - case 'set': - if (!empty($comp)) { - $this->setUnixTimestamp(call_user_func(Zend_Locale_Math::$sub, $this->getUnixTimestamp(), $comp)); - } - $this->setUnixTimestamp(call_user_func(Zend_Locale_Math::$add, $this->getUnixTimestamp(), $date)); - $value = $this->getUnixTimestamp(); - - break; - case 'add': - $this->setUnixTimestamp(call_user_func(Zend_Locale_Math::$add, $this->getUnixTimestamp(), $date)); - $value = $this->getUnixTimestamp(); - - break; - case 'sub': - $this->setUnixTimestamp(call_user_func(Zend_Locale_Math::$sub, $this->getUnixTimestamp(), $date)); - $value = $this->getUnixTimestamp(); - - break; - default: - // cmp - compare - return call_user_func(Zend_Locale_Math::$comp, $comp, $date); - - break; - } - - // dst-correction if 'fix_dst' = true and dst !== false but only for non UTC and non GMT - if ((self::$_options['fix_dst'] === true) and ($dst !== false) and ($this->_dst === true)) { - $hour = $this->toString(self::HOUR, 'iso'); - if ($hour != $dst) { - if (($dst == ($hour + 1)) or ($dst == ($hour - 23))) { - $value += 3600; - } elseif (($dst == ($hour - 1)) or ($dst == ($hour + 23))) { - $value -= 3600; - } - $this->setUnixTimestamp($value); - } - } - - return $this->getUnixTimestamp(); - } - - /** - * Calculates the date or object. - * - * @param string $calc Calculation to make, one of: 'add'|'sub'|'cmp'|'copy'|'set' - * @param array|int|string|Zend_Date $date Date or datepart to calculate with - * @param string $part Part of the date to calculate, if null the timestamp is used - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|string|Zend_Date new timestamp - */ - private function _calculate($calc, $date, $part, $locale) - { - $found = null; - if ($date === null) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('parameter $date must be set, null is not allowed'); - } - - if (($part !== null) && (strlen($part) !== 2) && (Zend_Locale::isLocale($part, null, false))) { - $locale = $part; - $part = null; - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - $locale = (string) $locale; - - // Create date parts - $year = $this->toString(self::YEAR, 'iso'); - $month = $this->toString(self::MONTH_SHORT, 'iso'); - $day = $this->toString(self::DAY_SHORT, 'iso'); - $hour = $this->toString(self::HOUR_SHORT, 'iso'); - $minute = $this->toString(self::MINUTE_SHORT, 'iso'); - $second = $this->toString(self::SECOND_SHORT, 'iso'); - // If object extract value - if ($date instanceof Zend_Date) { - $date = $date->toString($part, 'iso', $locale); - } - - if (is_array($date) === true) { - if (empty($part) === false) { - switch ($part) { - // Fall through - case self::DAY: - case self::DAY_SHORT: - if (isset($date['day']) === true) { - $date = $date['day']; - } - - break; - // Fall through - case self::WEEKDAY_SHORT: - case self::WEEKDAY: - case self::WEEKDAY_8601: - case self::WEEKDAY_DIGIT: - case self::WEEKDAY_NARROW: - case self::WEEKDAY_NAME: - if (isset($date['weekday']) === true) { - $date = $date['weekday']; - $part = self::WEEKDAY_DIGIT; - } - - break; - case self::DAY_OF_YEAR: - if (isset($date['day_of_year']) === true) { - $date = $date['day_of_year']; - } - - break; - // Fall through - case self::MONTH: - case self::MONTH_SHORT: - case self::MONTH_NAME: - case self::MONTH_NAME_SHORT: - case self::MONTH_NAME_NARROW: - if (isset($date['month']) === true) { - $date = $date['month']; - } - - break; - // Fall through - case self::YEAR: - case self::YEAR_SHORT: - case self::YEAR_8601: - case self::YEAR_SHORT_8601: - if (isset($date['year']) === true) { - $date = $date['year']; - } - - break; - // Fall through - case self::HOUR: - case self::HOUR_AM: - case self::HOUR_SHORT: - case self::HOUR_SHORT_AM: - if (isset($date['hour']) === true) { - $date = $date['hour']; - } - - break; - // Fall through - case self::MINUTE: - case self::MINUTE_SHORT: - if (isset($date['minute']) === true) { - $date = $date['minute']; - } - - break; - // Fall through - case self::SECOND: - case self::SECOND_SHORT: - if (isset($date['second']) === true) { - $date = $date['second']; - } - - break; - // Fall through - case self::TIMEZONE: - case self::TIMEZONE_NAME: - if (isset($date['timezone']) === true) { - $date = $date['timezone']; - } - - break; - case self::TIMESTAMP: - if (isset($date['timestamp']) === true) { - $date = $date['timestamp']; - } - - break; - case self::WEEK: - if (isset($date['week']) === true) { - $date = $date['week']; - } - - break; - case self::TIMEZONE_SECS: - if (isset($date['gmtsecs']) === true) { - $date = $date['gmtsecs']; - } - - break; - default: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("datepart for part ($part) not found in array"); - - break; - } - } else { - $hours = 0; - if (isset($date['hour']) === true) { - $hours = $date['hour']; - } - $minutes = 0; - if (isset($date['minute']) === true) { - $minutes = $date['minute']; - } - $seconds = 0; - if (isset($date['second']) === true) { - $seconds = $date['second']; - } - $months = 0; - if (isset($date['month']) === true) { - $months = $date['month']; - } - $days = 0; - if (isset($date['day']) === true) { - $days = $date['day']; - } - $years = 0; - if (isset($date['year']) === true) { - $years = $date['year']; - } - - return $this->_assign($calc, $this->mktime($hours, $minutes, $seconds, $months, $days, $years, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), $hour); - } - } - - // $date as object, part of foreign date as own date - switch ($part) { - // day formats - case self::DAY: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true), - $this->mktime(0, 0, 0, 1, 1 + intval($day), 1970, true), $hour); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, day expected", 0, null, $date); - - break; - - case self::WEEKDAY_SHORT: - $daylist = Zend_Locale_Data::getList($locale, 'day'); - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - $cnt = 0; - - foreach ($daylist as $key => $value) { - if (strtoupper(iconv_substr($value, 0, 3, 'UTF-8')) == strtoupper($date)) { - $found = $cnt; - - break; - } - ++$cnt; - } - - // Weekday found - if ($cnt < 7) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::DAY_SHORT: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true), - $this->mktime(0, 0, 0, 1, 1 + intval($day), 1970, true), $hour); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, day expected", 0, null, $date); - - break; - - case self::WEEKDAY: - $daylist = Zend_Locale_Data::getList($locale, 'day'); - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - $cnt = 0; - - foreach ($daylist as $key => $value) { - if (strtoupper($value) == strtoupper($date)) { - $found = $cnt; - - break; - } - ++$cnt; - } - - // Weekday found - if ($cnt < 7) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::WEEKDAY_8601: - $weekday = (int) $this->toString(self::WEEKDAY_8601, 'iso', $locale); - if ((intval($date) > 0) and (intval($date) < 8)) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::DAY_SUFFIX: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('day suffix not supported', 0, null, $date); - - break; - - case self::WEEKDAY_DIGIT: - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - if (is_numeric($date) and (intval($date) >= 0) and (intval($date) < 7)) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $date, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::DAY_OF_YEAR: - if (is_numeric($date)) { - if (($calc == 'add') || ($calc == 'sub')) { - $year = 1970; - ++$date; - ++$day; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, $date, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, day expected", 0, null, $date); - - break; - - case self::WEEKDAY_NARROW: - $daylist = Zend_Locale_Data::getList($locale, 'day', ['gregorian', 'format', 'abbreviated']); - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - $cnt = 0; - foreach ($daylist as $key => $value) { - if (strtoupper(iconv_substr($value, 0, 1, 'UTF-8')) == strtoupper($date)) { - $found = $cnt; - - break; - } - ++$cnt; - } - - // Weekday found - if ($cnt < 7) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::WEEKDAY_NAME: - $daylist = Zend_Locale_Data::getList($locale, 'day', ['gregorian', 'format', 'abbreviated']); - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - $cnt = 0; - foreach ($daylist as $key => $value) { - if (strtoupper($value) == strtoupper($date)) { - $found = $cnt; - - break; - } - ++$cnt; - } - - // Weekday found - if ($cnt < 7) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - // week formats - case self::WEEK: - if (is_numeric($date)) { - $week = (int) $this->toString(self::WEEK, 'iso', $locale); - - return $this->_assign($calc, parent::mktime(0, 0, 0, 1, 1 + ($date * 7), 1970, true), - parent::mktime(0, 0, 0, 1, 1 + ($week * 7), 1970, true), $hour); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, week expected", 0, null, $date); - - break; - - // month formats - case self::MONTH_NAME: - $monthlist = Zend_Locale_Data::getList($locale, 'month'); - $cnt = 0; - foreach ($monthlist as $key => $value) { - if (strtoupper($value) == strtoupper($date)) { - $found = $key; - - break; - } - ++$cnt; - } - $date = array_search($date, $monthlist); - - // Monthname found - if ($cnt < 12) { - $fixday = 0; - if ($calc == 'add') { - $date += $found; - $calc = 'set'; - if (self::$_options['extend_month'] == false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc == 'sub') { - $date = $month - $found; - $calc = 'set'; - if (self::$_options['extend_month'] == false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - // Monthname not found - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - case self::MONTH: - if (is_numeric($date)) { - $fixday = 0; - if ($calc == 'add') { - $date += $month; - $calc = 'set'; - if (self::$_options['extend_month'] == false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc == 'sub') { - $date = $month - $date; - $calc = 'set'; - if (self::$_options['extend_month'] == false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - case self::MONTH_NAME_SHORT: - $monthlist = Zend_Locale_Data::getList($locale, 'month', ['gregorian', 'format', 'abbreviated']); - $cnt = 0; - foreach ($monthlist as $key => $value) { - if (strtoupper($value) == strtoupper($date)) { - $found = $key; - - break; - } - ++$cnt; - } - $date = array_search($date, $monthlist); - - // Monthname found - if ($cnt < 12) { - $fixday = 0; - if ($calc == 'add') { - $date += $found; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc == 'sub') { - $date = $month - $found; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - // Monthname not found - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - case self::MONTH_SHORT: - if (is_numeric($date) === true) { - $fixday = 0; - if ($calc === 'add') { - $date += $month; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc === 'sub') { - $date = $month - $date; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - case self::MONTH_DAYS: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('month days not supported', 0, null, $date); - - break; - - case self::MONTH_NAME_NARROW: - $monthlist = Zend_Locale_Data::getList($locale, 'month', ['gregorian', 'stand-alone', 'narrow']); - $cnt = 0; - foreach ($monthlist as $key => $value) { - if (strtoupper($value) === strtoupper($date)) { - $found = $key; - - break; - } - ++$cnt; - } - $date = array_search($date, $monthlist); - - // Monthname found - if ($cnt < 12) { - $fixday = 0; - if ($calc === 'add') { - $date += $found; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc === 'sub') { - $date = $month - $found; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - // Monthname not found - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - // year formats - case self::LEAPYEAR: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('leap year not supported', 0, null, $date); - - break; - - case self::YEAR_8601: - if (is_numeric($date)) { - if ($calc === 'add') { - $date += $year; - $calc = 'set'; - } elseif ($calc === 'sub') { - $date = $year - $date; - $calc = 'set'; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, intval($date), true), - $this->mktime(0, 0, 0, $month, $day, $year, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); - - break; - - case self::YEAR: - if (is_numeric($date)) { - if ($calc === 'add') { - $date += $year; - $calc = 'set'; - } elseif ($calc === 'sub') { - $date = $year - $date; - $calc = 'set'; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, intval($date), true), - $this->mktime(0, 0, 0, $month, $day, $year, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); - - break; - - case self::YEAR_SHORT: - if (is_numeric($date)) { - $date = intval($date); - if (($calc == 'set') || ($calc == 'cmp')) { - $date = self::getFullYear($date); - } - if ($calc === 'add') { - $date += $year; - $calc = 'set'; - } elseif ($calc === 'sub') { - $date = $year - $date; - $calc = 'set'; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, $date, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); - - break; - - case self::YEAR_SHORT_8601: - if (is_numeric($date)) { - $date = intval($date); - if (($calc === 'set') || ($calc === 'cmp')) { - $date = self::getFullYear($date); - } - if ($calc === 'add') { - $date += $year; - $calc = 'set'; - } elseif ($calc === 'sub') { - $date = $year - $date; - $calc = 'set'; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, $date, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); - - break; - - // time formats - case self::MERIDIEM: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('meridiem not supported', 0, null, $date); - - break; - - case self::SWATCH: - if (is_numeric($date)) { - $rest = intval($date); - $hours = floor($rest * 24 / 1000); - $rest = $rest - ($hours * 1000 / 24); - $minutes = floor($rest * 1440 / 1000); - $rest = $rest - ($minutes * 1000 / 1440); - $seconds = floor($rest * 86400 / 1000); - - return $this->_assign($calc, $this->mktime($hours, $minutes, $seconds, 1, 1, 1970, true), - $this->mktime($hour, $minute, $second, 1, 1, 1970, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, swatchstamp expected", 0, null, $date); - - break; - - case self::HOUR_SHORT_AM: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true), - $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); - - break; - - case self::HOUR_SHORT: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true), - $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); - - break; - - case self::HOUR_AM: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true), - $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); - - break; - - case self::HOUR: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true), - $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); - - break; - - case self::MINUTE: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, intval($date), 0, 1, 1, 1970, true), - $this->mktime(0, $minute, 0, 1, 1, 1970, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, minute expected", 0, null, $date); - - break; - - case self::SECOND: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, 0, intval($date), 1, 1, 1970, true), - $this->mktime(0, 0, $second, 1, 1, 1970, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, second expected", 0, null, $date); - - break; - - case self::MILLISECOND: - if (is_numeric($date)) { - switch ($calc) { - case 'set': - return $this->setMillisecond($date); - - break; - case 'add': - return $this->addMillisecond($date); - - break; - case 'sub': - return $this->subMillisecond($date); - - break; - } - - return $this->compareMillisecond($date); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, milliseconds expected", 0, null, $date); - - break; - - case self::MINUTE_SHORT: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, intval($date), 0, 1, 1, 1970, true), - $this->mktime(0, $minute, 0, 1, 1, 1970, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, minute expected", 0, null, $date); - - break; - - case self::SECOND_SHORT: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, 0, intval($date), 1, 1, 1970, true), - $this->mktime(0, 0, $second, 1, 1, 1970, true), false); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, second expected", 0, null, $date); - - break; - - // timezone formats - // break intentionally omitted - case self::TIMEZONE_NAME: - case self::TIMEZONE: - case self::TIMEZONE_SECS: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('timezone not supported', 0, null, $date); - - break; - - case self::DAYLIGHT: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('daylight not supported', 0, null, $date); - - break; - - case self::GMT_DIFF: - case self::GMT_DIFF_SEP: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('gmtdiff not supported', 0, null, $date); - - break; - - // date strings - case self::ISO_8601: - // (-)YYYY-MM-dd - preg_match('/^(-{0,1}\d{4})-(\d{2})-(\d{2})/', $date, $datematch); - // (-)YY-MM-dd - if (empty($datematch)) { - preg_match('/^(-{0,1}\d{2})-(\d{2})-(\d{2})/', $date, $datematch); - } - // (-)YYYYMMdd - if (empty($datematch)) { - preg_match('/^(-{0,1}\d{4})(\d{2})(\d{2})/', $date, $datematch); - } - // (-)YYMMdd - if (empty($datematch)) { - preg_match('/^(-{0,1}\d{2})(\d{2})(\d{2})/', $date, $datematch); - } - $tmpdate = $date; - if (!empty($datematch)) { - $dateMatchCharCount = iconv_strlen($datematch[0], 'UTF-8'); - $tmpdate = iconv_substr($date, - $dateMatchCharCount, - iconv_strlen($date, 'UTF-8') - $dateMatchCharCount, - 'UTF-8'); - } - // (T)hh:mm:ss - preg_match('/[T,\s]{0,1}(\d{2}):(\d{2}):(\d{2})/', $tmpdate, $timematch); - // (T)hhmmss - if (empty($timematch)) { - preg_match('/[T,\s]{0,1}(\d{2})(\d{2})(\d{2})/', $tmpdate, $timematch); - } - // (T)hh:mm - if (empty($timematch)) { - preg_match('/[T,\s]{0,1}(\d{2}):(\d{2})/', $tmpdate, $timematch); - } - // (T)hhmm - if (empty($timematch)) { - preg_match('/[T,\s]{0,1}(\d{2})(\d{2})/', $tmpdate, $timematch); - } - if (empty($datematch) and empty($timematch)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("unsupported ISO8601 format ($date)", 0, null, $date); - } - if (!empty($timematch)) { - $timeMatchCharCount = iconv_strlen($timematch[0], 'UTF-8'); - $tmpdate = iconv_substr($tmpdate, - $timeMatchCharCount, - iconv_strlen($tmpdate, 'UTF-8') - $timeMatchCharCount, - 'UTF-8'); - } - if (empty($datematch)) { - $datematch[1] = 1970; - $datematch[2] = 1; - $datematch[3] = 1; - } elseif (iconv_strlen($datematch[1], 'UTF-8') == 2) { - $datematch[1] = self::getFullYear($datematch[1]); - } - if (empty($timematch)) { - $timematch[1] = 0; - $timematch[2] = 0; - $timematch[3] = 0; - } - if (!isset($timematch[3])) { - $timematch[3] = 0; - } - - if (($calc == 'set') || ($calc == 'cmp')) { - --$datematch[2]; - --$month; - --$datematch[3]; - --$day; - $datematch[1] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($timematch[1], $timematch[2], $timematch[3], 1 + $datematch[2], 1 + $datematch[3], 1970 + $datematch[1], false), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, false), false); - - break; - - case self::RFC_2822: - $result = preg_match('/^\w{3},\s(\d{1,2})\s(\w{3})\s(\d{4})\s' - . '(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]' - . '{1}\d{4}|\w{1,20})$/', $date, $match); - - if (!$result) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("no RFC 2822 format ($date)", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], false), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, false), false); - - break; - - case self::TIMESTAMP: - if (is_numeric($date)) { - return $this->_assign($calc, $date, $this->getUnixTimestamp()); - } - - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, timestamp expected", 0, null, $date); - - break; - - // additional formats - // break intentionally omitted - case self::ERA: - case self::ERA_NAME: - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('era not supported', 0, null, $date); - - break; - - case self::DATES: - try { - $parsed = Zend_Locale_Format::getDate($date, ['locale' => $locale, 'format_type' => 'iso', 'fix_date' => true]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATE_FULL: - try { - $format = Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'full']); - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATE_LONG: - try { - $format = Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'long']); - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATE_MEDIUM: - try { - $format = Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'medium']); - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATE_SHORT: - try { - $format = Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'short']); - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - $parsed['year'] = self::getFullYear($parsed['year']); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIMES: - try { - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - $parsed = Zend_Locale_Format::getTime($date, ['locale' => $locale, 'format_type' => 'iso', 'fix_date' => true]); - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIME_FULL: - try { - $format = Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'full']); - $parsed = Zend_Locale_Format::getTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - - if (!isset($parsed['second'])) { - $parsed['second'] = 0; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIME_LONG: - try { - $format = Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'long']); - $parsed = Zend_Locale_Format::getTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIME_MEDIUM: - try { - $format = Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'medium']); - $parsed = Zend_Locale_Format::getTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIME_SHORT: - try { - $format = Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'short']); - $parsed = Zend_Locale_Format::getTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - - if (!isset($parsed['second'])) { - $parsed['second'] = 0; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME: - try { - $parsed = Zend_Locale_Format::getDateTime($date, ['locale' => $locale, 'format_type' => 'iso', 'fix_date' => true]); - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME_FULL: - try { - $format = Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'full']); - $parsed = Zend_Locale_Format::getDateTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - if (!isset($parsed['second'])) { - $parsed['second'] = 0; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME_LONG: - try { - $format = Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'long']); - $parsed = Zend_Locale_Format::getDateTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME_MEDIUM: - try { - $format = Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'medium']); - $parsed = Zend_Locale_Format::getDateTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME_SHORT: - try { - $format = Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'short']); - $parsed = Zend_Locale_Format::getDateTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - $parsed['year'] = self::getFullYear($parsed['year']); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - if (!isset($parsed['second'])) { - $parsed['second'] = 0; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - // ATOM and RFC_3339 are identical - case self::ATOM: - case self::RFC_3339: - $result = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\d{0,4}([+-]{1}\d{2}:\d{2}|Z)$/', $date, $match); - if (!$result) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, ATOM format expected", 0, null, $date); - } - - if (($calc == 'set') || ($calc == 'cmp')) { - --$match[2]; - --$month; - --$match[3]; - --$day; - $match[1] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $match[2], 1 + $match[3], 1970 + $match[1], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::COOKIE: - $result = preg_match("/^\w{6,9},\s(\d{2})-(\w{3})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})\s.{3,20}$/", $date, $match); - if (!$result) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, COOKIE format expected", 0, null, $date); - } - $matchStartPos = iconv_strpos($match[0], ' ', 0, 'UTF-8') + 1; - $match[0] = iconv_substr($match[0], - $matchStartPos, - iconv_strlen($match[0], 'UTF-8') - $matchStartPos, - 'UTF-8'); - - $months = $this->_getDigitFromName($match[2]); - $match[3] = self::getFullYear($match[3]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::RFC_822: - case self::RFC_1036: - // new RFC 822 format, identical to RFC 1036 standard - $result = preg_match('/^\w{0,3},{0,1}\s{0,1}(\d{1,2})\s(\w{3})\s(\d{2})\s(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]{1}\d{4}|\w{1,20})$/', $date, $match); - if (!$result) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, RFC 822 date format expected", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - $match[3] = self::getFullYear($match[3]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], false), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, false), false); - - break; - - case self::RFC_850: - $result = preg_match('/^\w{6,9},\s(\d{2})-(\w{3})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})\s.{3,21}$/', $date, $match); - if (!$result) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, RFC 850 date format expected", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - $match[3] = self::getFullYear($match[3]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::RFC_1123: - $result = preg_match('/^\w{0,3},{0,1}\s{0,1}(\d{1,2})\s(\w{3})\s(\d{2,4})\s(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]{1}\d{4}|\w{1,20})$/', $date, $match); - if (!$result) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, RFC 1123 date format expected", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::RSS: - $result = preg_match('/^\w{3},\s(\d{2})\s(\w{3})\s(\d{2,4})\s(\d{1,2}):(\d{2}):(\d{2})\s.{1,21}$/', $date, $match); - if (!$result) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, RSS date format expected", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - $match[3] = self::getFullYear($match[3]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::W3C: - $result = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})[+-]{1}\d{2}:\d{2}$/', $date, $match); - if (!$result) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid date ($date) operand, W3C date format expected", 0, null, $date); - } - - if (($calc == 'set') || ($calc == 'cmp')) { - --$match[2]; - --$month; - --$match[3]; - --$day; - $match[1] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $match[2], 1 + $match[3], 1970 + $match[1], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - default: - if (!is_numeric($date) || !empty($part)) { - try { - if (empty($part)) { - $part = Zend_Locale_Format::getDateFormat($locale) . ' '; - $part .= Zend_Locale_Format::getTimeFormat($locale); - } - - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $part, 'locale' => $locale, 'fix_date' => true, 'format_type' => 'iso']); - if ((strpos(strtoupper($part), 'YY') !== false) and (strpos(strtoupper($part), 'YYYY') === false)) { - $parsed['year'] = self::getFullYear($parsed['year']); - } - - if (($calc == 'set') || ($calc == 'cmp')) { - if (isset($parsed['month'])) { - --$parsed['month']; - } else { - $parsed['month'] = 0; - } - - if (isset($parsed['day'])) { - --$parsed['day']; - } else { - $parsed['day'] = 0; - } - - if (!isset($parsed['year'])) { - $parsed['year'] = 1970; - } - } - - return $this->_assign($calc, $this->mktime( - $parsed['hour'] ?? 0, - $parsed['minute'] ?? 0, - $parsed['second'] ?? 0, - isset($parsed['month']) ? (1 + $parsed['month']) : 1, - isset($parsed['day']) ? (1 + $parsed['day']) : 1, - $parsed['year'], - false), $this->getUnixTimestamp(), false); - } catch (Zend_Locale_Exception $e) { - if (!is_numeric($date)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - } - } - - return $this->_assign($calc, $date, $this->getUnixTimestamp(), false); - - break; - } - } - - /** - * Returns true when both date objects or date parts are equal. - * For example: - * 15.May.2000 <-> 15.June.2000 Equals only for Day or Year... all other will return false. - * - * @param array|int|string|Zend_Date $date Date or datepart to equal with - * @param string $part OPTIONAL Part of the date to compare, if null the timestamp is used - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return bool - */ - public function equals($date, $part = self::TIMESTAMP, $locale = null) - { - $result = $this->compare($date, $part, $locale); - - if ($result == 0) { - return true; - } - - return false; - } - - /** - * Returns if the given date or datepart is earlier - * For example: - * 15.May.2000 <-> 13.June.1999 will return true for day, year and date, but not for month. - * - * @param array|int|string|Zend_Date $date Date or datepart to compare with - * @param string $part OPTIONAL Part of the date to compare, if null the timestamp is used - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return bool - */ - public function isEarlier($date, $part = null, $locale = null) - { - $result = $this->compare($date, $part, $locale); - - if ($result == -1) { - return true; - } - - return false; - } - - /** - * Returns if the given date or datepart is later - * For example: - * 15.May.2000 <-> 13.June.1999 will return true for month but false for day, year and date - * Returns if the given date is later. - * - * @param array|int|string|Zend_Date $date Date or datepart to compare with - * @param string $part OPTIONAL Part of the date to compare, if null the timestamp is used - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return bool - */ - public function isLater($date, $part = null, $locale = null) - { - $result = $this->compare($date, $part, $locale); - - if ($result == 1) { - return true; - } - - return false; - } - - /** - * Returns only the time of the date as new Zend_Date object - * For example: - * 15.May.2000 10:11:23 will return a dateobject equal to 01.Jan.1970 10:11:23. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getTime($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'H:i:s'; - } else { - $format = self::TIME_MEDIUM; - } - - return $this->copyPart($format, $locale); - } - - /** - * Returns the calculated time. - * - * @param string $calc Calculation to make - * @param array|int|string|Zend_Date $time Time to calculate with, if null the actual time is taken - * @param string $format Timeformat for parsing input - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date new time - */ - private function _time($calc, $time, $format, $locale) - { - if ($time === null) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('parameter $time must be set, null is not allowed'); - } - - if ($time instanceof Zend_Date) { - // extract time from object - $time = $time->toString('HH:mm:ss', 'iso'); - } else { - if (is_array($time)) { - if ((isset($time['hour']) === true) or (isset($time['minute']) === true) - or (isset($time['second']) === true)) { - $parsed = $time; - } else { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('no hour, minute or second given in array'); - } - } else { - if (self::$_options['format_type'] == 'php') { - $format = Zend_Locale_Format::convertPhpToIsoFormat($format); - } - - try { - if ($locale === null) { - $locale = $this->getLocale(); - } - - $parsed = Zend_Locale_Format::getTime($time, ['date_format' => $format, 'locale' => $locale, 'format_type' => 'iso']); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e); - } - } - - if (!array_key_exists('hour', $parsed)) { - $parsed['hour'] = 0; - } - - if (!array_key_exists('minute', $parsed)) { - $parsed['minute'] = 0; - } - - if (!array_key_exists('second', $parsed)) { - $parsed['second'] = 0; - } - - $time = str_pad($parsed['hour'], 2, '0', STR_PAD_LEFT) . ':'; - $time .= str_pad($parsed['minute'], 2, '0', STR_PAD_LEFT) . ':'; - $time .= str_pad($parsed['second'], 2, '0', STR_PAD_LEFT); - } - - $return = $this->_calcdetail($calc, $time, self::TIMES, 'de'); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new time for the date object. Format defines how to parse the time string. - * Also a complete date can be given, but only the time is used for setting. - * For example: dd.MMMM.yyTHH:mm' and 'ss sec'-> 10.May.07T25:11 and 44 sec => 1h11min44sec + 1 day - * Returned is the new date object and the existing date is left as it was before. - * - * @param array|int|string|Zend_Date $time Time to set - * @param string $format OPTIONAL Timeformat for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setTime($time, $format = null, $locale = null) - { - return $this->_time('set', $time, $format, $locale); - } - - /** - * Adds a time to the existing date. Format defines how to parse the time string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: HH:mm:ss -> 10 -> +10 hours. - * - * @param array|int|string|Zend_Date $time Time to add - * @param string $format OPTIONAL Timeformat for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addTime($time, $format = null, $locale = null) - { - return $this->_time('add', $time, $format, $locale); - } - - /** - * Subtracts a time from the existing date. Format defines how to parse the time string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: HH:mm:ss -> 10 -> -10 hours. - * - * @param array|int|string|Zend_Date $time Time to sub - * @param string $format OPTIONAL Timeformat for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent inteface - */ - public function subTime($time, $format = null, $locale = null) - { - return $this->_time('sub', $time, $format, $locale); - } - - /** - * Compares the time from the existing date. Format defines how to parse the time string. - * If only parts are given the other parts are set to default. - * If no format us given, the standardformat of this locale is used. - * For example: HH:mm:ss -> 10 -> 10 hours. - * - * @param array|int|string|Zend_Date $time Time to compare - * @param string $format OPTIONAL Timeformat for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareTime($time, $format = null, $locale = null) - { - return $this->_time('cmp', $time, $format, $locale); - } - - /** - * Returns a clone of $this, with the time part set to 00:00:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getDate($locale = null) - { - $orig = self::$_options['format_type']; - if (self::$_options['format_type'] == 'php') { - self::$_options['format_type'] = 'iso'; - } - - $date = $this->copyPart(self::DATE_MEDIUM, $locale); - $date->addTimestamp($this->getGmtOffset()); - self::$_options['format_type'] = $orig; - - return $date; - } - - /** - * Returns the calculated date. - * - * @param string $calc Calculation to make - * @param array|int|string|Zend_Date $date Date to calculate with, if null the actual date is taken - * @param string $format Date format for parsing - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date new date - */ - private function _date($calc, $date, $format, $locale) - { - if ($date === null) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('parameter $date must be set, null is not allowed'); - } - - if ($date instanceof Zend_Date) { - // extract date from object - $date = $date->toString('d.M.y', 'iso'); - } else { - if (is_array($date)) { - if ((isset($date['year']) === true) or (isset($date['month']) === true) - or (isset($date['day']) === true)) { - $parsed = $date; - } else { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('no day,month or year given in array'); - } - } else { - if ((self::$_options['format_type'] == 'php') && !defined($format)) { - $format = Zend_Locale_Format::convertPhpToIsoFormat($format); - } - - try { - if ($locale === null) { - $locale = $this->getLocale(); - } - - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'locale' => $locale, 'format_type' => 'iso']); - if ((strpos(strtoupper($format), 'YY') !== false) and (strpos(strtoupper($format), 'YYYY') === false)) { - $parsed['year'] = self::getFullYear($parsed['year']); - } - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e); - } - } - - if (!array_key_exists('day', $parsed)) { - $parsed['day'] = 1; - } - - if (!array_key_exists('month', $parsed)) { - $parsed['month'] = 1; - } - - if (!array_key_exists('year', $parsed)) { - $parsed['year'] = 0; - } - - $date = $parsed['day'] . '.' . $parsed['month'] . '.' . $parsed['year']; - } - - $return = $this->_calcdetail($calc, $date, self::DATE_MEDIUM, 'de'); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new date for the date object. Format defines how to parse the date string. - * Also a complete date with time can be given, but only the date is used for setting. - * For example: MMMM.yy HH:mm-> May.07 22:11 => 01.May.07 00:00 - * Returned is the new date object and the existing time is left as it was before. - * - * @param array|int|string|Zend_Date $date Date to set - * @param string $format OPTIONAL Date format for parsing - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setDate($date, $format = null, $locale = null) - { - return $this->_date('set', $date, $format, $locale); - } - - /** - * Adds a date to the existing date object. Format defines how to parse the date string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: MM.dd.YYYY -> 10 -> +10 months. - * - * @param array|int|string|Zend_Date $date Date to add - * @param string $format OPTIONAL Date format for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addDate($date, $format = null, $locale = null) - { - return $this->_date('add', $date, $format, $locale); - } - - /** - * Subtracts a date from the existing date object. Format defines how to parse the date string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: MM.dd.YYYY -> 10 -> -10 months - * Be aware: Subtracting 2 months is not equal to Adding -2 months !!! - * - * @param array|int|string|Zend_Date $date Date to sub - * @param string $format OPTIONAL Date format for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subDate($date, $format = null, $locale = null) - { - return $this->_date('sub', $date, $format, $locale); - } - - /** - * Compares the date from the existing date object, ignoring the time. - * Format defines how to parse the date string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: 10.01.2000 => 10.02.1999 -> false. - * - * @param array|int|string|Zend_Date $date Date to compare - * @param string $format OPTIONAL Date format for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareDate($date, $format = null, $locale = null) - { - return $this->_date('cmp', $date, $format, $locale); - } - - /** - * Returns the full ISO 8601 date from the date object. - * Always the complete ISO 8601 specifiction is used. If an other ISO date is needed - * (ISO 8601 defines several formats) use toString() instead. - * This function does not return the ISO date as object. Use copy() instead. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return string - */ - public function getIso($locale = null) - { - return $this->toString(self::ISO_8601, 'iso', $locale); - } - - /** - * Sets a new date for the date object. Not given parts are set to default. - * Only supported ISO 8601 formats are accepted. - * For example: 050901 -> 01.Sept.2005 00:00:00, 20050201T10:00:30 -> 01.Feb.2005 10h00m30s - * Returned is the new date object. - * - * @param int|string|Zend_Date $date ISO Date to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setIso($date, $locale = null) - { - return $this->_calcvalue('set', $date, 'iso', self::ISO_8601, $locale); - } - - /** - * Adds a ISO date to the date object. Not given parts are set to default. - * Only supported ISO 8601 formats are accepted. - * For example: 050901 -> + 01.Sept.2005 00:00:00, 10:00:00 -> +10h - * Returned is the new date object. - * - * @param int|string|Zend_Date $date ISO Date to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addIso($date, $locale = null) - { - return $this->_calcvalue('add', $date, 'iso', self::ISO_8601, $locale); - } - - /** - * Subtracts a ISO date from the date object. Not given parts are set to default. - * Only supported ISO 8601 formats are accepted. - * For example: 050901 -> - 01.Sept.2005 00:00:00, 10:00:00 -> -10h - * Returned is the new date object. - * - * @param int|string|Zend_Date $date ISO Date to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subIso($date, $locale = null) - { - return $this->_calcvalue('sub', $date, 'iso', self::ISO_8601, $locale); - } - - /** - * Compares a ISO date with the date object. Not given parts are set to default. - * Only supported ISO 8601 formats are accepted. - * For example: 050901 -> - 01.Sept.2005 00:00:00, 10:00:00 -> -10h - * Returns if equal, earlier or later. - * - * @param int|string|Zend_Date $date ISO Date to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareIso($date, $locale = null) - { - return $this->_calcvalue('cmp', $date, 'iso', self::ISO_8601, $locale); - } - - /** - * Returns a RFC 822 compilant datestring from the date object. - * This function does not return the RFC date as object. Use copy() instead. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return string - */ - public function getArpa($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'D\, d M y H\:i\:s O'; - } else { - $format = self::RFC_822; - } - - return $this->toString($format, 'iso', $locale); - } - - /** - * Sets a RFC 822 date as new date for the date object. - * Only RFC 822 compilant date strings are accepted. - * For example: Sat, 14 Feb 09 00:31:30 +0100 - * Returned is the new date object. - * - * @param int|string|Zend_Date $date RFC 822 to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setArpa($date, $locale = null) - { - return $this->_calcvalue('set', $date, 'arpa', self::RFC_822, $locale); - } - - /** - * Adds a RFC 822 date to the date object. - * ARPA messages are used in emails or HTTP Headers. - * Only RFC 822 compilant date strings are accepted. - * For example: Sat, 14 Feb 09 00:31:30 +0100 - * Returned is the new date object. - * - * @param int|string|Zend_Date $date RFC 822 Date to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addArpa($date, $locale = null) - { - return $this->_calcvalue('add', $date, 'arpa', self::RFC_822, $locale); - } - - /** - * Subtracts a RFC 822 date from the date object. - * ARPA messages are used in emails or HTTP Headers. - * Only RFC 822 compilant date strings are accepted. - * For example: Sat, 14 Feb 09 00:31:30 +0100 - * Returned is the new date object. - * - * @param int|string|Zend_Date $date RFC 822 Date to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subArpa($date, $locale = null) - { - return $this->_calcvalue('sub', $date, 'arpa', self::RFC_822, $locale); - } - - /** - * Compares a RFC 822 compilant date with the date object. - * ARPA messages are used in emails or HTTP Headers. - * Only RFC 822 compilant date strings are accepted. - * For example: Sat, 14 Feb 09 00:31:30 +0100 - * Returns if equal, earlier or later. - * - * @param int|string|Zend_Date $date RFC 822 Date to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareArpa($date, $locale = null) - { - return $this->_calcvalue('cmp', $date, 'arpa', self::RFC_822, $locale); - } - - /** - * Check if location is supported. - * - * @param array $location locations array - * - * @return float $horizon float - */ - private function _checkLocation($location) - { - if (!isset($location['longitude']) or !isset($location['latitude'])) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('Location must include \'longitude\' and \'latitude\'', 0, null, $location); - } - if (($location['longitude'] > 180) or ($location['longitude'] < -180)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('Longitude must be between -180 and 180', 0, null, $location); - } - if (($location['latitude'] > 90) or ($location['latitude'] < -90)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('Latitude must be between -90 and 90', 0, null, $location); - } - - if (!isset($location['horizon'])) { - $location['horizon'] = 'effective'; - } - - switch ($location['horizon']) { - case 'civil': - return -0.104528; - - break; - case 'nautic': - return -0.207912; - - break; - case 'astronomic': - return -0.309017; - - break; - default: - return -0.0145439; - - break; - } - } - - /** - * Returns the time of sunrise for this date and a given location as new date object - * For a list of cities and correct locations use the class Zend_Date_Cities. - * - * @param array $location location of sunrise - * ['horizon'] -> civil, nautic, astronomical, effective (default) - * ['longitude'] -> longitude of location - * ['latitude'] -> latitude of location - * - * @return Zend_Date - */ - public function getSunrise($location) - { - $horizon = $this->_checkLocation($location); - $result = clone $this; - $result->set($this->calcSun($location, $horizon, true), self::TIMESTAMP); - - return $result; - } - - /** - * Returns the time of sunset for this date and a given location as new date object - * For a list of cities and correct locations use the class Zend_Date_Cities. - * - * @param array $location location of sunset - * ['horizon'] -> civil, nautic, astronomical, effective (default) - * ['longitude'] -> longitude of location - * ['latitude'] -> latitude of location - * - * @return Zend_Date - */ - public function getSunset($location) - { - $horizon = $this->_checkLocation($location); - $result = clone $this; - $result->set($this->calcSun($location, $horizon, false), self::TIMESTAMP); - - return $result; - } - - /** - * Returns an array with the sunset and sunrise dates for all horizon types - * For a list of cities and correct locations use the class Zend_Date_Cities. - * - * @param array $location location of suninfo - * ['horizon'] -> civil, nautic, astronomical, effective (default) - * ['longitude'] -> longitude of location - * ['latitude'] -> latitude of location - * - * @return array - [sunset|sunrise][effective|civil|nautic|astronomic] - */ - public function getSunInfo($location) - { - $suninfo = []; - for ($i = 0; $i < 4; ++$i) { - switch ($i) { - case 0: - $location['horizon'] = 'effective'; - - break; - case 1: - $location['horizon'] = 'civil'; - - break; - case 2: - $location['horizon'] = 'nautic'; - - break; - case 3: - $location['horizon'] = 'astronomic'; - - break; - } - $horizon = $this->_checkLocation($location); - $result = clone $this; - $result->set($this->calcSun($location, $horizon, true), self::TIMESTAMP); - $suninfo['sunrise'][$location['horizon']] = $result; - $result = clone $this; - $result->set($this->calcSun($location, $horizon, false), self::TIMESTAMP); - $suninfo['sunset'][$location['horizon']] = $result; - } - - return $suninfo; - } - - /** - * Check a given year for leap year. - * - * @param array|int|Zend_Date $year Year to check - * - * @return bool - */ - public static function checkLeapYear($year) - { - if ($year instanceof Zend_Date) { - $year = (int) $year->toString(self::YEAR, 'iso'); - } - - if (is_array($year)) { - if (isset($year['year']) === true) { - $year = $year['year']; - } else { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('no year given in array'); - } - } - - if (!is_numeric($year)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("year ($year) has to be integer for checkLeapYear()", 0, null, $year); - } - - return (bool) parent::isYearLeapYear($year); - } - - /** - * Returns true, if the year is a leap year. - * - * @return bool - */ - public function isLeapYear() - { - return self::checkLeapYear($this); - } - - /** - * Returns if the set date is todays date. - * - * @return bool - */ - public function isToday() - { - $today = $this->date('Ymd', $this->_getTime()); - $day = $this->date('Ymd', $this->getUnixTimestamp()); - - return $today == $day; - } - - /** - * Returns if the set date is yesterdays date. - * - * @return bool - */ - public function isYesterday() - { - [$year, $month, $day] = explode('-', $this->date('Y-m-d', $this->_getTime())); - // adjusts for leap days and DST changes that are timezone specific - $yesterday = $this->date('Ymd', $this->mktime(0, 0, 0, $month, $day - 1, $year)); - $day = $this->date('Ymd', $this->getUnixTimestamp()); - - return $day == $yesterday; - } - - /** - * Returns if the set date is tomorrows date. - * - * @return bool - */ - public function isTomorrow() - { - [$year, $month, $day] = explode('-', $this->date('Y-m-d', $this->_getTime())); - // adjusts for leap days and DST changes that are timezone specific - $tomorrow = $this->date('Ymd', $this->mktime(0, 0, 0, $month, $day + 1, $year)); - $day = $this->date('Ymd', $this->getUnixTimestamp()); - - return $day == $tomorrow; - } - - /** - * Returns the actual date as new date object. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public static function now($locale = null) - { - return new Zend_Date(time(), self::TIMESTAMP, $locale); - } - - /** - * Calculate date details. - * - * @param string $calc Calculation to make - * @param array|int|string|Zend_Date $date Date or Part to calculate - * @param string $type Datepart for Calculation - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|string new date - */ - private function _calcdetail($calc, $date, $type, $locale) - { - $old = false; - if (self::$_options['format_type'] == 'php') { - self::$_options['format_type'] = 'iso'; - $old = true; - } - - switch ($calc) { - case 'set': - $return = $this->set($date, $type, $locale); - - break; - case 'add': - $return = $this->add($date, $type, $locale); - - break; - case 'sub': - $return = $this->sub($date, $type, $locale); - - break; - default: - $return = $this->compare($date, $type, $locale); - - break; - } - - if ($old) { - self::$_options['format_type'] = 'php'; - } - - return $return; - } - - /** - * Internal calculation, returns the requested date type. - * - * @param string $calc Calculation to make - * @param int|string|Zend_Date $value Datevalue to calculate with, if null the actual value is taken - * @param string $type - * @param string $parameter - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date new date - */ - private function _calcvalue($calc, $value, $type, $parameter, $locale) - { - if ($value === null) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("parameter $type must be set, null is not allowed"); - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($value instanceof Zend_Date) { - // extract value from object - $value = $value->toString($parameter, 'iso', $locale); - } elseif (!is_array($value) && !is_numeric($value) && ($type != 'iso') && ($type != 'arpa')) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid $type ($value) operand", 0, null, $value); - } - - $return = $this->_calcdetail($calc, $value, $parameter, $locale); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Returns only the year from the date object as new object. - * For example: 10.May.2000 10:30:00 -> 01.Jan.2000 00:00:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getYear($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'Y'; - } else { - $format = self::YEAR; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets a new year - * If the year is between 0 and 69, 2000 will be set (2000-2069) - * If the year if between 70 and 99, 1999 will be set (1970-1999) - * 3 or 4 digit years are set as expected. If you need to set year 0-99 - * use set() instead. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $year Year to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setYear($year, $locale = null) - { - return $this->_calcvalue('set', $year, 'year', self::YEAR, $locale); - } - - /** - * Adds the year to the existing date object - * If the year is between 0 and 69, 2000 will be added (2000-2069) - * If the year if between 70 and 99, 1999 will be added (1970-1999) - * 3 or 4 digit years are added as expected. If you need to add years from 0-99 - * use add() instead. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $year Year to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addYear($year, $locale = null) - { - return $this->_calcvalue('add', $year, 'year', self::YEAR, $locale); - } - - /** - * Subs the year from the existing date object - * If the year is between 0 and 69, 2000 will be subtracted (2000-2069) - * If the year if between 70 and 99, 1999 will be subtracted (1970-1999) - * 3 or 4 digit years are subtracted as expected. If you need to subtract years from 0-99 - * use sub() instead. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $year Year to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subYear($year, $locale = null) - { - return $this->_calcvalue('sub', $year, 'year', self::YEAR, $locale); - } - - /** - * Compares the year with the existing date object, ignoring other date parts. - * For example: 10.03.2000 -> 15.02.2000 -> true - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $year Year to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareYear($year, $locale = null) - { - return $this->_calcvalue('cmp', $year, 'year', self::YEAR, $locale); - } - - /** - * Returns only the month from the date object as new object. - * For example: 10.May.2000 10:30:00 -> 01.May.1970 00:00:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getMonth($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'm'; - } else { - $format = self::MONTH; - } - - return $this->copyPart($format, $locale); - } - - /** - * Returns the calculated month. - * - * @param string $calc Calculation to make - * @param array|int|string|Zend_Date $month Month to calculate with, if null the actual month is taken - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date new time - */ - private function _month($calc, $month, $locale) - { - $found = null; - if ($month === null) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('parameter $month must be set, null is not allowed'); - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($month instanceof Zend_Date) { - // extract month from object - $found = $month->toString(self::MONTH_SHORT, 'iso', $locale); - } else { - if (is_numeric($month)) { - $found = $month; - } elseif (is_array($month)) { - if (isset($month['month']) === true) { - $month = $month['month']; - } else { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('no month given in array'); - } - } else { - $monthlist = Zend_Locale_Data::getList($locale, 'month'); - $monthlist2 = Zend_Locale_Data::getList($locale, 'month', ['gregorian', 'format', 'abbreviated']); - - $monthlist = array_merge($monthlist, $monthlist2); - $found = 0; - $cnt = 0; - foreach ($monthlist as $key => $value) { - if (strtoupper($value) == strtoupper($month)) { - $found = ($key % 12) + 1; - - break; - } - ++$cnt; - } - if ($found == 0) { - foreach ($monthlist2 as $key => $value) { - if (strtoupper(iconv_substr($value, 0, 1, 'UTF-8')) == strtoupper($month)) { - $found = $key + 1; - - break; - } - ++$cnt; - } - } - if ($found == 0) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("unknown month name ($month)", 0, null, $month); - } - } - } - $return = $this->_calcdetail($calc, $found, self::MONTH_SHORT, $locale); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new month - * The month can be a number or a string. Setting months lower then 0 and greater then 12 - * will result in adding or subtracting the relevant year. (12 months equal one year) - * If a localized monthname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $month Month to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setMonth($month, $locale = null) - { - return $this->_month('set', $month, $locale); - } - - /** - * Adds months to the existing date object. - * The month can be a number or a string. Adding months lower then 0 and greater then 12 - * will result in adding or subtracting the relevant year. (12 months equal one year) - * If a localized monthname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $month Month to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addMonth($month, $locale = null) - { - return $this->_month('add', $month, $locale); - } - - /** - * Subtracts months from the existing date object. - * The month can be a number or a string. Subtracting months lower then 0 and greater then 12 - * will result in adding or subtracting the relevant year. (12 months equal one year) - * If a localized monthname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $month Month to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subMonth($month, $locale = null) - { - return $this->_month('sub', $month, $locale); - } - - /** - * Compares the month with the existing date object, ignoring other date parts. - * For example: 10.03.2000 -> 15.03.1950 -> true - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $month Month to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareMonth($month, $locale = null) - { - return $this->_month('cmp', $month, $locale); - } - - /** - * Returns the day as new date object - * Example: 20.May.1986 -> 20.Jan.1970 00:00:00. - * - * @param Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getDay($locale = null) - { - return $this->copyPart(self::DAY_SHORT, $locale); - } - - /** - * Returns the calculated day. - * - * @param string $calc Type of calculation to make - * @param Zend_Date $day Day to calculate, when null the actual day is calculated - * @param Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date - */ - private function _day($calc, $day, $locale) - { - if ($day === null) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('parameter $day must be set, null is not allowed'); - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($day instanceof Zend_Date) { - $day = $day->toString(self::DAY_SHORT, 'iso', $locale); - } - - if (is_numeric($day)) { - $type = self::DAY_SHORT; - } elseif (is_array($day)) { - if (isset($day['day']) === true) { - $day = $day['day']; - $type = self::WEEKDAY; - } else { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('no day given in array'); - } - } else { - switch (iconv_strlen($day, 'UTF-8')) { - case 1 : - $type = self::WEEKDAY_NARROW; - - break; - case 2: - $type = self::WEEKDAY_NAME; - - break; - case 3: - $type = self::WEEKDAY_SHORT; - - break; - default: - $type = self::WEEKDAY; - - break; - } - } - $return = $this->_calcdetail($calc, $day, $type, $locale); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new day - * The day can be a number or a string. Setting days lower then 0 or greater than the number of this months days - * will result in adding or subtracting the relevant month. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object - * Example: setDay('Montag', 'de_AT'); will set the monday of this week as day. - * - * @param array|int|string|Zend_Date $day Day to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setDay($day, $locale = null) - { - return $this->_day('set', $day, $locale); - } - - /** - * Adds days to the existing date object. - * The day can be a number or a string. Adding days lower then 0 or greater than the number of this months days - * will result in adding or subtracting the relevant month. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * - * @param array|int|string|Zend_Date $day Day to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addDay($day, $locale = null) - { - return $this->_day('add', $day, $locale); - } - - /** - * Subtracts days from the existing date object. - * The day can be a number or a string. Subtracting days lower then 0 or greater than the number of this months days - * will result in adding or subtracting the relevant month. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * - * @param array|int|string|Zend_Date $day Day to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subDay($day, $locale = null) - { - return $this->_day('sub', $day, $locale); - } - - /** - * Compares the day with the existing date object, ignoring other date parts. - * For example: 'Monday', 'en' -> 08.Jan.2007 -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $day Day to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareDay($day, $locale = null) - { - return $this->_day('cmp', $day, $locale); - } - - /** - * Returns the weekday as new date object - * Weekday is always from 1-7 - * Example: 09-Jan-2007 -> 2 = Tuesday -> 02-Jan-1970 (when 02.01.1970 is also Tuesday). - * - * @param Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getWeekday($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'l'; - } else { - $format = self::WEEKDAY; - } - - return $this->copyPart($format, $locale); - } - - /** - * Returns the calculated weekday. - * - * @param string $calc Type of calculation to make - * @param Zend_Date $weekday Weekday to calculate, when null the actual weekday is calculated - * @param Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date - */ - private function _weekday($calc, $weekday, $locale) - { - if ($weekday === null) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('parameter $weekday must be set, null is not allowed'); - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($weekday instanceof Zend_Date) { - $weekday = $weekday->toString(self::WEEKDAY_8601, 'iso', $locale); - } - - if (is_numeric($weekday)) { - $type = self::WEEKDAY_8601; - } elseif (is_array($weekday)) { - if (isset($weekday['weekday']) === true) { - $weekday = $weekday['weekday']; - $type = self::WEEKDAY; - } else { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('no weekday given in array'); - } - } else { - switch (iconv_strlen($weekday, 'UTF-8')) { - case 1: - $type = self::WEEKDAY_NARROW; - - break; - case 2: - $type = self::WEEKDAY_NAME; - - break; - case 3: - $type = self::WEEKDAY_SHORT; - - break; - default: - $type = self::WEEKDAY; - - break; - } - } - $return = $this->_calcdetail($calc, $weekday, $type, $locale); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new weekday - * The weekday can be a number or a string. If a localized weekday name is given, - * then it will be parsed as a date in $locale (defaults to the same locale as $this). - * Returned is the new date object. - * Example: setWeekday(3); will set the wednesday of this week as day. - * - * @param array|int|string|Zend_Date $weekday Weekday to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setWeekday($weekday, $locale = null) - { - return $this->_weekday('set', $weekday, $locale); - } - - /** - * Adds weekdays to the existing date object. - * The weekday can be a number or a string. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object - * Example: addWeekday(3); will add the difference of days from the begining of the month until - * wednesday. - * - * @param array|int|string|Zend_Date $weekday Weekday to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addWeekday($weekday, $locale = null) - { - return $this->_weekday('add', $weekday, $locale); - } - - /** - * Subtracts weekdays from the existing date object. - * The weekday can be a number or a string. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object - * Example: subWeekday(3); will subtract the difference of days from the begining of the month until - * wednesday. - * - * @param array|int|string|Zend_Date $weekday Weekday to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subWeekday($weekday, $locale = null) - { - return $this->_weekday('sub', $weekday, $locale); - } - - /** - * Compares the weekday with the existing date object, ignoring other date parts. - * For example: 'Monday', 'en' -> 08.Jan.2007 -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $weekday Weekday to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareWeekday($weekday, $locale = null) - { - return $this->_weekday('cmp', $weekday, $locale); - } - - /** - * Returns the day of year as new date object - * Example: 02.Feb.1986 10:00:00 -> 02.Feb.1970 00:00:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getDayOfYear($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'D'; - } else { - $format = self::DAY_OF_YEAR; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets a new day of year - * The day of year is always a number. - * Returned is the new date object - * Example: 04.May.2004 -> setDayOfYear(10) -> 10.Jan.2004. - * - * @param array|int|string|Zend_Date $day Day of Year to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setDayOfYear($day, $locale = null) - { - return $this->_calcvalue('set', $day, 'day of year', self::DAY_OF_YEAR, $locale); - } - - /** - * Adds a day of year to the existing date object. - * The day of year is always a number. - * Returned is the new date object - * Example: addDayOfYear(10); will add 10 days to the existing date object. - * - * @param array|int|string|Zend_Date $day Day of Year to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addDayOfYear($day, $locale = null) - { - return $this->_calcvalue('add', $day, 'day of year', self::DAY_OF_YEAR, $locale); - } - - /** - * Subtracts a day of year from the existing date object. - * The day of year is always a number. - * Returned is the new date object - * Example: subDayOfYear(10); will subtract 10 days from the existing date object. - * - * @param array|int|string|Zend_Date $day Day of Year to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subDayOfYear($day, $locale = null) - { - return $this->_calcvalue('sub', $day, 'day of year', self::DAY_OF_YEAR, $locale); - } - - /** - * Compares the day of year with the existing date object. - * For example: compareDayOfYear(33) -> 02.Feb.2007 -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $day Day of Year to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareDayOfYear($day, $locale = null) - { - return $this->_calcvalue('cmp', $day, 'day of year', self::DAY_OF_YEAR, $locale); - } - - /** - * Returns the hour as new date object - * Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 10:00:00. - * - * @param Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getHour($locale = null) - { - return $this->copyPart(self::HOUR, $locale); - } - - /** - * Sets a new hour - * The hour is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> setHour(7); -> 04.May.1993 07:07:25. - * - * @param array|int|string|Zend_Date $hour Hour to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setHour($hour, $locale = null) - { - return $this->_calcvalue('set', $hour, 'hour', self::HOUR_SHORT, $locale); - } - - /** - * Adds hours to the existing date object. - * The hour is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> addHour(12); -> 05.May.1993 01:07:25. - * - * @param array|int|string|Zend_Date $hour Hour to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addHour($hour, $locale = null) - { - return $this->_calcvalue('add', $hour, 'hour', self::HOUR_SHORT, $locale); - } - - /** - * Subtracts hours from the existing date object. - * The hour is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> subHour(6); -> 05.May.1993 07:07:25. - * - * @param array|int|string|Zend_Date $hour Hour to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subHour($hour, $locale = null) - { - return $this->_calcvalue('sub', $hour, 'hour', self::HOUR_SHORT, $locale); - } - - /** - * Compares the hour with the existing date object. - * For example: 10:30:25 -> compareHour(10) -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $hour Hour to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareHour($hour, $locale = null) - { - return $this->_calcvalue('cmp', $hour, 'hour', self::HOUR_SHORT, $locale); - } - - /** - * Returns the minute as new date object - * Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 00:30:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getMinute($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'i'; - } else { - $format = self::MINUTE; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets a new minute - * The minute is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> setMinute(29); -> 04.May.1993 13:29:25. - * - * @param array|int|string|Zend_Date $minute Minute to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setMinute($minute, $locale = null) - { - return $this->_calcvalue('set', $minute, 'minute', self::MINUTE_SHORT, $locale); - } - - /** - * Adds minutes to the existing date object. - * The minute is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> addMinute(65); -> 04.May.1993 13:12:25. - * - * @param array|int|string|Zend_Date $minute Minute to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addMinute($minute, $locale = null) - { - return $this->_calcvalue('add', $minute, 'minute', self::MINUTE_SHORT, $locale); - } - - /** - * Subtracts minutes from the existing date object. - * The minute is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> subMinute(9); -> 04.May.1993 12:58:25. - * - * @param array|int|string|Zend_Date $minute Minute to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subMinute($minute, $locale = null) - { - return $this->_calcvalue('sub', $minute, 'minute', self::MINUTE_SHORT, $locale); - } - - /** - * Compares the minute with the existing date object. - * For example: 10:30:25 -> compareMinute(30) -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $minute Hour to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareMinute($minute, $locale = null) - { - return $this->_calcvalue('cmp', $minute, 'minute', self::MINUTE_SHORT, $locale); - } - - /** - * Returns the second as new date object - * Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 00:00:25. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getSecond($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 's'; - } else { - $format = self::SECOND; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets new seconds to the existing date object. - * The second is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> setSecond(100); -> 04.May.1993 13:08:40. - * - * @param array|int|string|Zend_Date $second Second to set - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setSecond($second, $locale = null) - { - return $this->_calcvalue('set', $second, 'second', self::SECOND_SHORT, $locale); - } - - /** - * Adds seconds to the existing date object. - * The second is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> addSecond(65); -> 04.May.1993 13:08:30. - * - * @param array|int|string|Zend_Date $second Second to add - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addSecond($second, $locale = null) - { - return $this->_calcvalue('add', $second, 'second', self::SECOND_SHORT, $locale); - } - - /** - * Subtracts seconds from the existing date object. - * The second is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> subSecond(10); -> 04.May.1993 13:07:15. - * - * @param array|int|string|Zend_Date $second Second to sub - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subSecond($second, $locale = null) - { - return $this->_calcvalue('sub', $second, 'second', self::SECOND_SHORT, $locale); - } - - /** - * Compares the second with the existing date object. - * For example: 10:30:25 -> compareSecond(25) -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $second Second to compare - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareSecond($second, $locale = null) - { - return $this->_calcvalue('cmp', $second, 'second', self::SECOND_SHORT, $locale); - } - - /** - * Returns the precision for fractional seconds. - * - * @return int - */ - public function getFractionalPrecision() - { - return $this->_precision; - } - - /** - * Sets a new precision for fractional seconds. - * - * @param int $precision Precision for the fractional datepart 3 = milliseconds - * - * @return Zend_Date Provides a fluent interface - */ - public function setFractionalPrecision($precision) - { - if (!intval($precision) or ($precision < 0) or ($precision > 9)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); - } - - $this->_precision = (int) $precision; - if ($this->_precision < strlen($this->_fractional)) { - $this->_fractional = substr($this->_fractional, 0, $this->_precision); - } else { - $this->_fractional = str_pad($this->_fractional, $this->_precision, '0', STR_PAD_RIGHT); - } - - return $this; - } - - /** - * Returns the milliseconds of the date object. - * - * @return string - */ - public function getMilliSecond() - { - return $this->_fractional; - } - - /** - * Sets new milliseconds for the date object - * Example: setMilliSecond(550, 2) -> equals +5 Sec +50 MilliSec. - * - * @param int|Zend_Date $milli (Optional) Millisecond to set, when null the actual millisecond is set - * @param int $precision (Optional) Fraction precision of the given milliseconds - * - * @return Zend_Date Provides a fluent interface - */ - public function setMilliSecond($milli = null, $precision = null) - { - if ($milli === null) { - [$milli, $time] = explode(' ', microtime()); - $milli = intval($milli); - $precision = 6; - } elseif (!is_numeric($milli)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid milli second ($milli) operand", 0, null, $milli); - } - - if ($precision === null) { - $precision = $this->_precision; - } - - if (!is_int($precision) || $precision < 1 || $precision > 9) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); - } - - $this->_fractional = 0; - $this->addMilliSecond($milli, $precision); - - return $this; - } - - /** - * Adds milliseconds to the date object. - * - * @param int|Zend_Date $milli (Optional) Millisecond to add, when null the actual millisecond is added - * @param int $precision (Optional) Fractional precision for the given milliseconds - * - * @return Zend_Date Provides a fluent interface - */ - public function addMilliSecond($milli = null, $precision = null) - { - if ($milli === null) { - [$milli, $time] = explode(' ', microtime()); - $milli = intval($milli); - } elseif (!is_numeric($milli)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid milli second ($milli) operand", 0, null, $milli); - } - - if ($precision === null) { - // Use internal default precision - // Is not as logic as using the length of the input. But this would break tests and maybe other things - // as an input value of integer 10, which is used in tests, must be parsed as 10 milliseconds (real milliseconds, precision 3) - // but with auto-detect of precision, 100 milliseconds would be added. - $precision = $this->_precision; - } - - if (!is_int($precision) || $precision < 1 || $precision > 9) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception( - "precision ($precision) must be a positive integer less than 10", 0, null, $precision - ); - } - - if ($this->_precision > $precision) { - $milli = $milli * 10 ** ($this->_precision - $precision); - } elseif ($this->_precision < $precision) { - $milli = round($milli / 10 ** ($precision - $this->_precision)); - } - - $this->_fractional += $milli; - - // Add/sub milliseconds + add/sub seconds - $max = 10 ** $this->_precision; - // Milli includes seconds - if ($this->_fractional >= $max) { - while ($this->_fractional >= $max) { - $this->addSecond(1); - $this->_fractional -= $max; - } - } - - if ($this->_fractional < 0) { - while ($this->_fractional < 0) { - $this->subSecond(1); - $this->_fractional += $max; - } - } - - if ($this->_precision > strlen($this->_fractional)) { - $this->_fractional = str_pad($this->_fractional, $this->_precision, '0', STR_PAD_LEFT); - } - - return $this; - } - - /** - * Subtracts a millisecond. - * - * @param int|Zend_Date $milli (Optional) Millisecond to sub, when null the actual millisecond is subtracted - * @param int $precision (Optional) Fractional precision for the given milliseconds - * - * @return Zend_Date Provides a fluent interface - */ - public function subMilliSecond($milli = null, $precision = null) - { - $this->addMilliSecond(0 - $milli, $precision); - - return $this; - } - - /** - * Compares only the millisecond part, returning the difference. - * - * @param int|Zend_Date $milli OPTIONAL Millisecond to compare, when null the actual millisecond is compared - * @param int $precision OPTIONAL Fractional precision for the given milliseconds - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareMilliSecond($milli = null, $precision = null) - { - if ($milli === null) { - [$milli, $time] = explode(' ', microtime()); - $milli = intval($milli); - } elseif (is_numeric($milli) === false) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("invalid milli second ($milli) operand", 0, null, $milli); - } - - if ($precision === null) { - $precision = strlen($milli); - } elseif (!is_int($precision) || $precision < 1 || $precision > 9) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); - } - - if ($precision === 0) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('precision is 0'); - } - - if ($precision != $this->_precision) { - if ($precision > $this->_precision) { - $diff = $precision - $this->_precision; - $milli = (int) ($milli / (10 * $diff)); - } else { - $diff = $this->_precision - $precision; - $milli = (int) ($milli * (10 * $diff)); - } - } - - $comp = $this->_fractional - $milli; - if ($comp < 0) { - return -1; - } - if ($comp > 0) { - return 1; - } - - return 0; - } - - /** - * Returns the week as new date object using monday as begining of the week - * Example: 12.Jan.2007 -> 08.Jan.1970 00:00:00. - * - * @param Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getWeek($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'W'; - } else { - $format = self::WEEK; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets a new week. The week is always a number. The day of week is not changed. - * Returned is the new date object - * Example: 09.Jan.2007 13:07:25 -> setWeek(1); -> 02.Jan.2007 13:07:25. - * - * @param array|int|string|Zend_Date $week Week to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setWeek($week, $locale = null) - { - return $this->_calcvalue('set', $week, 'week', self::WEEK, $locale); - } - - /** - * Adds a week. The week is always a number. The day of week is not changed. - * Returned is the new date object - * Example: 09.Jan.2007 13:07:25 -> addWeek(1); -> 16.Jan.2007 13:07:25. - * - * @param array|int|string|Zend_Date $week Week to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addWeek($week, $locale = null) - { - return $this->_calcvalue('add', $week, 'week', self::WEEK, $locale); - } - - /** - * Subtracts a week. The week is always a number. The day of week is not changed. - * Returned is the new date object - * Example: 09.Jan.2007 13:07:25 -> subWeek(1); -> 02.Jan.2007 13:07:25. - * - * @param array|int|string|Zend_Date $week Week to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subWeek($week, $locale = null) - { - return $this->_calcvalue('sub', $week, 'week', self::WEEK, $locale); - } - - /** - * Compares only the week part, returning the difference - * Returned is the new date object - * Returns if equal, earlier or later - * Example: 09.Jan.2007 13:07:25 -> compareWeek(2); -> 0. - * - * @param array|int|string|Zend_Date $week Week to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareWeek($week, $locale = null) - { - return $this->_calcvalue('cmp', $week, 'week', self::WEEK, $locale); - } - - /** - * Sets a new standard locale for the date object. - * This locale will be used for all functions - * Returned is the really set locale. - * Example: 'de_XX' will be set to 'de' because 'de_XX' does not exist - * 'xx_YY' will be set to 'root' because 'xx' does not exist. - * - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return Zend_Date Provides fluent interface - */ - public function setLocale($locale = null) - { - try { - $this->_locale = Zend_Locale::findLocale($locale); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception($e->getMessage(), 0, $e); - } - - return $this; - } - - /** - * Returns the actual set locale. - * - * @return string - */ - public function getLocale() - { - return $this->_locale; - } - - /** - * Checks if the given date is a real date or datepart. - * Returns false if a expected datepart is missing or a datepart exceeds its possible border. - * But the check will only be done for the expected dateparts which are given by format. - * If no format is given the standard dateformat for the actual locale is used. - * f.e. 30.February.2007 will return false if format is 'dd.MMMM.YYYY'. - * - * @param array|string|Zend_Date $date Date to parse for correctness - * @param string $format (Optional) Format for parsing the date string - * @param string|Zend_Locale $locale (Optional) Locale for parsing date parts - * - * @return bool True when all date parts are correct - */ - public static function isDate($date, $format = null, $locale = null) - { - if (!is_string($date) && !is_numeric($date) && !($date instanceof Zend_Date) - && !is_array($date)) { - return false; - } - - if (($format !== null) && ($format != 'ee') && ($format != 'ss') && ($format != 'GG') && ($format != 'MM') && ($format != 'EE') && ($format != 'TT') - && (Zend_Locale::isLocale($format, null, false))) { - $locale = $format; - $format = null; - } - - $locale = Zend_Locale::findLocale($locale); - - if ($format === null) { - $format = Zend_Locale_Format::getDateFormat($locale); - } elseif ((self::$_options['format_type'] == 'php') && !defined($format)) { - $format = Zend_Locale_Format::convertPhpToIsoFormat($format); - } - - $format = self::_getLocalizedToken($format, $locale); - if (!is_array($date)) { - try { - $parsed = Zend_Locale_Format::getDate($date, ['locale' => $locale, - 'date_format' => $format, 'format_type' => 'iso', - 'fix_date' => false, ]); - } catch (Zend_Locale_Exception $e) { - // Date can not be parsed - return false; - } - } else { - $parsed = $date; - } - - if (((strpos($format, 'Y') !== false) or (strpos($format, 'y') !== false)) - and (!isset($parsed['year']))) { - // Year expected but not found - return false; - } - - if ((strpos($format, 'M') !== false) and (!isset($parsed['month']))) { - // Month expected but not found - return false; - } - - if ((strpos($format, 'd') !== false) and (!isset($parsed['day']))) { - // Day expected but not found - return false; - } - - if (((strpos($format, 'H') !== false) or (strpos($format, 'h') !== false)) - and (!isset($parsed['hour']))) { - // Hour expected but not found - return false; - } - - if ((strpos($format, 'm') !== false) and (!isset($parsed['minute']))) { - // Minute expected but not found - return false; - } - - if ((strpos($format, 's') !== false) and (!isset($parsed['second']))) { - // Second expected but not found - return false; - } - - // Set not given dateparts - if (isset($parsed['hour']) === false) { - $parsed['hour'] = 12; - } - - if (isset($parsed['minute']) === false) { - $parsed['minute'] = 0; - } - - if (isset($parsed['second']) === false) { - $parsed['second'] = 0; - } - - if (isset($parsed['month']) === false) { - $parsed['month'] = 1; - } - - if (isset($parsed['day']) === false) { - $parsed['day'] = 1; - } - - if (isset($parsed['year']) === false) { - $parsed['year'] = 1970; - } - - if (self::isYearLeapYear($parsed['year'])) { - $parsed['year'] = 1972; - } else { - $parsed['year'] = 1971; - } - - $date = new self($parsed, null, $locale); - $timestamp = $date->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], - $parsed['month'], $parsed['day'], $parsed['year']); - - if ($parsed['year'] != $date->date('Y', $timestamp)) { - // Given year differs from parsed year - return false; - } - - if ($parsed['month'] != $date->date('n', $timestamp)) { - // Given month differs from parsed month - return false; - } - - if ($parsed['day'] != $date->date('j', $timestamp)) { - // Given day differs from parsed day - return false; - } - - if ($parsed['hour'] != $date->date('G', $timestamp)) { - // Given hour differs from parsed hour - return false; - } - - if ($parsed['minute'] != $date->date('i', $timestamp)) { - // Given minute differs from parsed minute - return false; - } - - if ($parsed['second'] != $date->date('s', $timestamp)) { - // Given second differs from parsed second - return false; - } - - return true; - } - - /** - * Returns the ISO Token for all localized constants. - * - * @param string $token Token to normalize - * @param string $locale Locale to search - * - * @return string - */ - protected static function _getLocalizedToken($token, $locale) - { - switch ($token) { - case self::ISO_8601: - return 'yyyy-MM-ddThh:mm:ss'; - - break; - case self::RFC_2822: - return 'EEE, dd MMM yyyy HH:mm:ss'; - - break; - case self::DATES: - return Zend_Locale_Data::getContent($locale, 'date'); - - break; - case self::DATE_FULL: - return Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'full']); - - break; - case self::DATE_LONG: - return Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'long']); - - break; - case self::DATE_MEDIUM: - return Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'medium']); - - break; - case self::DATE_SHORT: - return Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'short']); - - break; - case self::TIMES: - return Zend_Locale_Data::getContent($locale, 'time'); - - break; - case self::TIME_FULL: - return Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'full']); - - break; - case self::TIME_LONG: - return Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'long']); - - break; - case self::TIME_MEDIUM: - return Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'medium']); - - break; - case self::TIME_SHORT: - return Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'short']); - - break; - case self::DATETIME: - return Zend_Locale_Data::getContent($locale, 'datetime'); - - break; - case self::DATETIME_FULL: - return Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'full']); - - break; - case self::DATETIME_LONG: - return Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'long']); - - break; - case self::DATETIME_MEDIUM: - return Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'medium']); - - break; - case self::DATETIME_SHORT: - return Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'short']); - - break; - case self::ATOM: - case self::RFC_3339: - case self::W3C: - return 'yyyy-MM-DD HH:mm:ss'; - - break; - case self::COOKIE: - case self::RFC_850: - return 'EEEE, dd-MM-yyyy HH:mm:ss'; - - break; - case self::RFC_822: - case self::RFC_1036: - case self::RFC_1123: - case self::RSS: - return 'EEE, dd MM yyyy HH:mm:ss'; - - break; - } - - return $token; - } -} diff --git a/library/Zend/Date/Cities.php b/library/Zend/Date/Cities.php deleted file mode 100644 index 7974c8c2c..000000000 --- a/library/Zend/Date/Cities.php +++ /dev/null @@ -1,319 +0,0 @@ - ['latitude' => 5.3411111, 'longitude' => -4.0280556], - 'Abu Dhabi' => ['latitude' => 24.4666667, 'longitude' => 54.3666667], - 'Abuja' => ['latitude' => 9.1758333, 'longitude' => 7.1808333], - 'Accra' => ['latitude' => 5.55, 'longitude' => -0.2166667], - 'Adamstown' => ['latitude' => -25.0666667, 'longitude' => -130.0833333], - 'Addis Ababa' => ['latitude' => 9.0333333, 'longitude' => 38.7], - 'Adelaide' => ['latitude' => -34.9333333, 'longitude' => 138.6], - 'Algiers' => ['latitude' => 36.7630556, 'longitude' => 3.0505556], - 'Alofi' => ['latitude' => -19.0166667, 'longitude' => -169.9166667], - 'Amman' => ['latitude' => 31.95, 'longitude' => 35.9333333], - 'Amsterdam' => ['latitude' => 52.35, 'longitude' => 4.9166667], - 'Andorra la Vella' => ['latitude' => 42.5, 'longitude' => 1.5166667], - 'Ankara' => ['latitude' => 39.9272222, 'longitude' => 32.8644444], - 'Antananarivo' => ['latitude' => -18.9166667, 'longitude' => 47.5166667], - 'Apia' => ['latitude' => -13.8333333, 'longitude' => -171.7333333], - 'Ashgabat' => ['latitude' => 37.95, 'longitude' => 58.3833333], - 'Asmara' => ['latitude' => 15.3333333, 'longitude' => 38.9333333], - 'Astana' => ['latitude' => 51.1811111, 'longitude' => 71.4277778], - 'Asunción' => ['latitude' => -25.2666667, 'longitude' => -57.6666667], - 'Athens' => ['latitude' => 37.9833333, 'longitude' => 23.7333333], - 'Auckland' => ['latitude' => -36.8666667, 'longitude' => 174.7666667], - 'Avarua' => ['latitude' => -21.2, 'longitude' => -159.7666667], - 'Baghdad' => ['latitude' => 33.3386111, 'longitude' => 44.3938889], - 'Baku' => ['latitude' => 40.3952778, 'longitude' => 49.8822222], - 'Bamako' => ['latitude' => 12.65, 'longitude' => -8], - 'Bandar Seri Begawan' => ['latitude' => 4.8833333, 'longitude' => 114.9333333], - 'Bankok' => ['latitude' => 13.5833333, 'longitude' => 100.2166667], - 'Bangui' => ['latitude' => 4.3666667, 'longitude' => 18.5833333], - 'Banjul' => ['latitude' => 13.4530556, 'longitude' => -16.5775], - 'Basel' => ['latitude' => 47.5666667, 'longitude' => 7.6], - 'Basseterre' => ['latitude' => 17.3, 'longitude' => -62.7166667], - 'Beijing' => ['latitude' => 39.9288889, 'longitude' => 116.3883333], - 'Beirut' => ['latitude' => 33.8719444, 'longitude' => 35.5097222], - 'Belgrade' => ['latitude' => 44.8186111, 'longitude' => 20.4680556], - 'Belmopan' => ['latitude' => 17.25, 'longitude' => -88.7666667], - 'Berlin' => ['latitude' => 52.5166667, 'longitude' => 13.4], - 'Bern' => ['latitude' => 46.9166667, 'longitude' => 7.4666667], - 'Bishkek' => ['latitude' => 42.8730556, 'longitude' => 74.6002778], - 'Bissau' => ['latitude' => 11.85, 'longitude' => -15.5833333], - 'Bloemfontein' => ['latitude' => -29.1333333, 'longitude' => 26.2], - 'Bogotá' => ['latitude' => 4.6, 'longitude' => -74.0833333], - 'Brasilia' => ['latitude' => -15.7833333, 'longitude' => -47.9166667], - 'Bratislava' => ['latitude' => 48.15, 'longitude' => 17.1166667], - 'Brazzaville' => ['latitude' => -4.2591667, 'longitude' => 15.2847222], - 'Bridgetown' => ['latitude' => 13.1, 'longitude' => -59.6166667], - 'Brisbane' => ['latitude' => -27.5, 'longitude' => 153.0166667], - 'Brussels' => ['latitude' => 50.8333333, 'longitude' => 4.3333333], - 'Bucharest' => ['latitude' => 44.4333333, 'longitude' => 26.1], - 'Budapest' => ['latitude' => 47.5, 'longitude' => 19.0833333], - 'Buenos Aires' => ['latitude' => -34.5875, 'longitude' => -58.6725], - 'Bujumbura' => ['latitude' => -3.3761111, 'longitude' => 29.36], - 'Cairo' => ['latitude' => 30.05, 'longitude' => 31.25], - 'Calgary' => ['latitude' => 51.0833333, 'longitude' => -114.0833333], - 'Canberra' => ['latitude' => -35.2833333, 'longitude' => 149.2166667], - 'Cape Town' => ['latitude' => -33.9166667, 'longitude' => 18.4166667], - 'Caracas' => ['latitude' => 10.5, 'longitude' => -66.9166667], - 'Castries' => ['latitude' => 14, 'longitude' => -61], - 'Charlotte Amalie' => ['latitude' => 18.34389, 'longitude' => -64.93111], - 'Chicago' => ['latitude' => 41.85, 'longitude' => -87.65], - 'Chisinau' => ['latitude' => 47.055556, 'longitude' => 28.8575], - 'Cockburn Town' => ['latitude' => 21.4666667, 'longitude' => -71.1333333], - 'Colombo' => ['latitude' => 6.9319444, 'longitude' => 79.8477778], - 'Conakry' => ['latitude' => 9.5091667, 'longitude' => -13.7122222], - 'Copenhagen' => ['latitude' => 55.6666667, 'longitude' => 12.5833333], - 'Cotonou' => ['latitude' => 6.35, 'longitude' => 2.4333333], - 'Dakar' => ['latitude' => 14.6708333, 'longitude' => -17.4380556], - 'Damascus' => ['latitude' => 33.5, 'longitude' => 36.3], - 'Dar es Salaam' => ['latitude' => -6.8, 'longitude' => 39.2833333], - 'Dhaka' => ['latitude' => 23.7230556, 'longitude' => 90.4086111], - 'Dili' => ['latitude' => -8.5586111, 'longitude' => 125.5736111], - 'Djibouti' => ['latitude' => 11.595, 'longitude' => 43.1480556], - 'Dodoma' => ['latitude' => -6.1833333, 'longitude' => 35.75], - 'Doha' => ['latitude' => 25.2866667, 'longitude' => 51.5333333], - 'Dubai' => ['latitude' => 25.2522222, 'longitude' => 55.28], - 'Dublin' => ['latitude' => 53.3330556, 'longitude' => -6.2488889], - 'Dushanbe' => ['latitude' => 38.56, 'longitude' => 68.7738889], - 'Fagatogo' => ['latitude' => -14.2825, 'longitude' => -170.69], - 'Fongafale' => ['latitude' => -8.5166667, 'longitude' => 179.2166667], - 'Freetown' => ['latitude' => 8.49, 'longitude' => -13.2341667], - 'Gaborone' => ['latitude' => -24.6463889, 'longitude' => 25.9119444], - 'Geneva' => ['latitude' => 46.2, 'longitude' => 6.1666667], - 'George Town' => ['latitude' => 19.3, 'longitude' => -81.3833333], - 'Georgetown' => ['latitude' => 6.8, 'longitude' => -58.1666667], - 'Gibraltar' => ['latitude' => 36.1333333, 'longitude' => -5.35], - 'Glasgow' => ['latitude' => 55.8333333, 'longitude' => -4.25], - 'Guatemala la Nueva' => ['latitude' => 14.6211111, 'longitude' => -90.5269444], - 'Hagatna' => ['latitude' => 13.47417, 'longitude' => 144.74778], - 'The Hague' => ['latitude' => 52.0833333, 'longitude' => 4.3], - 'Hamilton' => ['latitude' => 32.2941667, 'longitude' => -64.7838889], - 'Hanoi' => ['latitude' => 21.0333333, 'longitude' => 105.85], - 'Harare' => ['latitude' => -17.8177778, 'longitude' => 31.0447222], - 'Havana' => ['latitude' => 23.1319444, 'longitude' => -82.3641667], - 'Helsinki' => ['latitude' => 60.1755556, 'longitude' => 24.9341667], - 'Honiara' => ['latitude' => -9.4333333, 'longitude' => 159.95], - 'Islamabad' => ['latitude' => 30.8486111, 'longitude' => 72.4944444], - 'Istanbul' => ['latitude' => 41.0186111, 'longitude' => 28.9647222], - 'Jakarta' => ['latitude' => -6.1744444, 'longitude' => 106.8294444], - 'Jamestown' => ['latitude' => -15.9333333, 'longitude' => -5.7166667], - 'Jerusalem' => ['latitude' => 31.7666667, 'longitude' => 35.2333333], - 'Johannesburg' => ['latitude' => -26.2, 'longitude' => 28.0833333], - 'Kabul' => ['latitude' => 34.5166667, 'longitude' => 69.1833333], - 'Kampala' => ['latitude' => 0.3155556, 'longitude' => 32.5655556], - 'Kathmandu' => ['latitude' => 27.7166667, 'longitude' => 85.3166667], - 'Khartoum' => ['latitude' => 15.5880556, 'longitude' => 32.5341667], - 'Kigali' => ['latitude' => -1.9536111, 'longitude' => 30.0605556], - 'Kingston' => ['latitude' => -29.05, 'longitude' => 167.95], - 'Kingstown' => ['latitude' => 13.1333333, 'longitude' => -61.2166667], - 'Kinshasa' => ['latitude' => -4.3, 'longitude' => 15.3], - 'Kolkata' => ['latitude' => 22.5697222, 'longitude' => 88.3697222], - 'Kuala Lumpur' => ['latitude' => 3.1666667, 'longitude' => 101.7], - 'Kuwait City' => ['latitude' => 29.3697222, 'longitude' => 47.9783333], - 'Kiev' => ['latitude' => 50.4333333, 'longitude' => 30.5166667], - 'La Paz' => ['latitude' => -16.5, 'longitude' => -68.15], - 'Libreville' => ['latitude' => 0.3833333, 'longitude' => 9.45], - 'Lilongwe' => ['latitude' => -13.9833333, 'longitude' => 33.7833333], - 'Lima' => ['latitude' => -12.05, 'longitude' => -77.05], - 'Lisbon' => ['latitude' => 38.7166667, 'longitude' => -9.1333333], - 'Ljubljana' => ['latitude' => 46.0552778, 'longitude' => 14.5144444], - 'Lobamba' => ['latitude' => -26.4666667, 'longitude' => 31.2], - 'Lomé' => ['latitude' => 9.7166667, 'longitude' => 38.3], - 'London' => ['latitude' => 51.5, 'longitude' => -0.1166667], - 'Los Angeles' => ['latitude' => 34.05222, 'longitude' => -118.24278], - 'Luanda' => ['latitude' => -8.8383333, 'longitude' => 13.2344444], - 'Lusaka' => ['latitude' => -15.4166667, 'longitude' => 28.2833333], - 'Luxembourg' => ['latitude' => 49.6116667, 'longitude' => 6.13], - 'Madrid' => ['latitude' => 40.4, 'longitude' => -3.6833333], - 'Majuro' => ['latitude' => 7.1, 'longitude' => 171.3833333], - 'Malabo' => ['latitude' => 3.75, 'longitude' => 8.7833333], - 'Managua' => ['latitude' => 12.1508333, 'longitude' => -86.2683333], - 'Manama' => ['latitude' => 26.2361111, 'longitude' => 50.5830556], - 'Manila' => ['latitude' => 14.6041667, 'longitude' => 120.9822222], - 'Maputo' => ['latitude' => -25.9652778, 'longitude' => 32.5891667], - 'Maseru' => ['latitude' => -29.3166667, 'longitude' => 27.4833333], - 'Mbabane' => ['latitude' => -26.3166667, 'longitude' => 31.1333333], - 'Melbourne' => ['latitude' => -37.8166667, 'longitude' => 144.9666667], - 'Melekeok' => ['latitude' => 7.4933333, 'longitude' => 134.6341667], - 'Mexiko City' => ['latitude' => 19.4341667, 'longitude' => -99.1386111], - 'Minsk' => ['latitude' => 53.9, 'longitude' => 27.5666667], - 'Mogadishu' => ['latitude' => 2.0666667, 'longitude' => 45.3666667], - 'Monaco' => ['latitude' => 43.7333333, 'longitude' => 7.4166667], - 'Monrovia' => ['latitude' => 6.3105556, 'longitude' => -10.8047222], - 'Montevideo' => ['latitude' => -34.8580556, 'longitude' => -56.1708333], - 'Montreal' => ['latitude' => 45.5, 'longitude' => -73.5833333], - 'Moroni' => ['latitude' => -11.7041667, 'longitude' => 43.2402778], - 'Moscow' => ['latitude' => 55.7522222, 'longitude' => 37.6155556], - 'Muscat' => ['latitude' => 23.6133333, 'longitude' => 58.5933333], - 'Nairobi' => ['latitude' => -1.3166667, 'longitude' => 36.8333333], - 'Nassau' => ['latitude' => 25.0833333, 'longitude' => -77.35], - 'N´Djamena' => ['latitude' => 12.1130556, 'longitude' => 15.0491667], - 'New Dehli' => ['latitude' => 28.6, 'longitude' => 77.2], - 'New York' => ['latitude' => 40.71417, 'longitude' => -74.00639], - 'Newcastle' => ['latitude' => -32.9166667, 'longitude' => 151.75], - 'Niamey' => ['latitude' => 13.6666667, 'longitude' => 1.7833333], - 'Nicosia' => ['latitude' => 35.1666667, 'longitude' => 33.3666667], - 'Nouakchott' => ['latitude' => 18.0863889, 'longitude' => -15.9752778], - 'Noumea' => ['latitude' => -22.2666667, 'longitude' => 166.45], - 'Nuku´alofa' => ['latitude' => -21.1333333, 'longitude' => -175.2], - 'Nuuk' => ['latitude' => 64.1833333, 'longitude' => -51.75], - 'Oranjestad' => ['latitude' => 12.5166667, 'longitude' => -70.0333333], - 'Oslo' => ['latitude' => 59.9166667, 'longitude' => 10.75], - 'Ouagadougou' => ['latitude' => 12.3702778, 'longitude' => -1.5247222], - 'Palikir' => ['latitude' => 6.9166667, 'longitude' => 158.15], - 'Panama City' => ['latitude' => 8.9666667, 'longitude' => -79.5333333], - 'Papeete' => ['latitude' => -17.5333333, 'longitude' => -149.5666667], - 'Paramaribo' => ['latitude' => 5.8333333, 'longitude' => -55.1666667], - 'Paris' => ['latitude' => 48.8666667, 'longitude' => 2.3333333], - 'Perth' => ['latitude' => -31.9333333, 'longitude' => 115.8333333], - 'Phnom Penh' => ['latitude' => 11.55, 'longitude' => 104.9166667], - 'Podgorica' => ['latitude' => 43.7752778, 'longitude' => 19.6827778], - 'Port Louis' => ['latitude' => -20.1666667, 'longitude' => 57.5], - 'Port Moresby' => ['latitude' => -9.4647222, 'longitude' => 147.1925], - 'Port-au-Prince' => ['latitude' => 18.5391667, 'longitude' => -72.335], - 'Port of Spain' => ['latitude' => 10.6666667, 'longitude' => -61.5], - 'Porto-Novo' => ['latitude' => 6.4833333, 'longitude' => 2.6166667], - 'Prague' => ['latitude' => 50.0833333, 'longitude' => 14.4666667], - 'Praia' => ['latitude' => 14.9166667, 'longitude' => -23.5166667], - 'Pretoria' => ['latitude' => -25.7069444, 'longitude' => 28.2294444], - 'Pyongyang' => ['latitude' => 39.0194444, 'longitude' => 125.7547222], - 'Quito' => ['latitude' => -0.2166667, 'longitude' => -78.5], - 'Rabat' => ['latitude' => 34.0252778, 'longitude' => -6.8361111], - 'Reykjavik' => ['latitude' => 64.15, 'longitude' => -21.95], - 'Riga' => ['latitude' => 56.95, 'longitude' => 24.1], - 'Rio de Janero' => ['latitude' => -22.9, 'longitude' => -43.2333333], - 'Road Town' => ['latitude' => 18.4166667, 'longitude' => -64.6166667], - 'Rome' => ['latitude' => 41.9, 'longitude' => 12.4833333], - 'Roseau' => ['latitude' => 15.3, 'longitude' => -61.4], - 'Rotterdam' => ['latitude' => 51.9166667, 'longitude' => 4.5], - 'Salvador' => ['latitude' => -12.9833333, 'longitude' => -38.5166667], - 'San José' => ['latitude' => 9.9333333, 'longitude' => -84.0833333], - 'San Juan' => ['latitude' => 18.46833, 'longitude' => -66.10611], - 'San Marino' => ['latitude' => 43.5333333, 'longitude' => 12.9666667], - 'San Salvador' => ['latitude' => 13.7086111, 'longitude' => -89.2030556], - 'Sanaá' => ['latitude' => 15.3547222, 'longitude' => 44.2066667], - 'Santa Cruz' => ['latitude' => -17.8, 'longitude' => -63.1666667], - 'Santiago' => ['latitude' => -33.45, 'longitude' => -70.6666667], - 'Santo Domingo' => ['latitude' => 18.4666667, 'longitude' => -69.9], - 'Sao Paulo' => ['latitude' => -23.5333333, 'longitude' => -46.6166667], - 'Sarajevo' => ['latitude' => 43.85, 'longitude' => 18.3833333], - 'Seoul' => ['latitude' => 37.5663889, 'longitude' => 126.9997222], - 'Shanghai' => ['latitude' => 31.2222222, 'longitude' => 121.4580556], - 'Sydney' => ['latitude' => -33.8833333, 'longitude' => 151.2166667], - 'Singapore' => ['latitude' => 1.2930556, 'longitude' => 103.8558333], - 'Skopje' => ['latitude' => 42, 'longitude' => 21.4333333], - 'Sofia' => ['latitude' => 42.6833333, 'longitude' => 23.3166667], - 'St. George´s' => ['latitude' => 12.05, 'longitude' => -61.75], - 'St. John´s' => ['latitude' => 17.1166667, 'longitude' => -61.85], - 'Stanley' => ['latitude' => -51.7, 'longitude' => -57.85], - 'Stockholm' => ['latitude' => 59.3333333, 'longitude' => 18.05], - 'Suva' => ['latitude' => -18.1333333, 'longitude' => 178.4166667], - 'Taipei' => ['latitude' => 25.0166667, 'longitude' => 121.45], - 'Tallinn' => ['latitude' => 59.4338889, 'longitude' => 24.7280556], - 'Tashkent' => ['latitude' => 41.3166667, 'longitude' => 69.25], - 'Tbilisi' => ['latitude' => 41.725, 'longitude' => 44.7908333], - 'Tegucigalpa' => ['latitude' => 14.1, 'longitude' => -87.2166667], - 'Tehran' => ['latitude' => 35.6719444, 'longitude' => 51.4244444], - 'The Hague' => ['latitude' => 52.0833333, 'longitude' => 4.3], - 'Thimphu' => ['latitude' => 27.4833333, 'longitude' => 89.6], - 'Tirana' => ['latitude' => 41.3275, 'longitude' => 19.8188889], - 'Tiraspol' => ['latitude' => 46.8402778, 'longitude' => 29.6433333], - 'Tokyo' => ['latitude' => 35.685, 'longitude' => 139.7513889], - 'Toronto' => ['latitude' => 43.6666667, 'longitude' => -79.4166667], - 'Tórshavn' => ['latitude' => 62.0166667, 'longitude' => -6.7666667], - 'Tripoli' => ['latitude' => 32.8925, 'longitude' => 13.18], - 'Tunis' => ['latitude' => 36.8027778, 'longitude' => 10.1797222], - 'Ulaanbaatar' => ['latitude' => 47.9166667, 'longitude' => 106.9166667], - 'Vaduz' => ['latitude' => 47.1333333, 'longitude' => 9.5166667], - 'Valletta' => ['latitude' => 35.8997222, 'longitude' => 14.5147222], - 'Valparaiso' => ['latitude' => -33.0477778, 'longitude' => -71.6011111], - 'Vancouver' => ['latitude' => 49.25, 'longitude' => -123.1333333], - 'Vatican City' => ['latitude' => 41.9, 'longitude' => 12.4833333], - 'Victoria' => ['latitude' => -4.6166667, 'longitude' => 55.45], - 'Vienna' => ['latitude' => 48.2, 'longitude' => 16.3666667], - 'Vientaine' => ['latitude' => 17.9666667, 'longitude' => 102.6], - 'Vilnius' => ['latitude' => 54.6833333, 'longitude' => 25.3166667], - 'Warsaw' => ['latitude' => 52.25, 'longitude' => 21], - 'Washington dc' => ['latitude' => 38.895, 'longitude' => -77.03667], - 'Wellington' => ['latitude' => -41.3, 'longitude' => 174.7833333], - 'Willemstad' => ['latitude' => 12.1, 'longitude' => -68.9166667], - 'Windhoek' => ['latitude' => -22.57, 'longitude' => 17.0836111], - 'Yamoussoukro' => ['latitude' => 6.8166667, 'longitude' => -5.2833333], - 'Yaoundé' => ['latitude' => 3.8666667, 'longitude' => 11.5166667], - 'Yerevan' => ['latitude' => 40.1811111, 'longitude' => 44.5136111], - 'Zürich' => ['latitude' => 47.3666667, 'longitude' => 8.55], - 'Zagreb' => ['latitude' => 45.8, 'longitude' => 16], - ]; - - /** - * Returns the location from the selected city. - * - * @param string $city City to get location for - * @param string $horizon Horizon to use : - * default: effective - * others are civil, nautic, astronomic - * - * @return array - */ - public static function City($city, $horizon = false) - { - foreach (self::$cities as $key => $value) { - if (strtolower($key) === strtolower($city)) { - $return = $value; - $return['horizon'] = $horizon; - - return $return; - } - } - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('unknown city'); - } - - /** - * Return a list with all known cities. - * - * @return array - */ - public static function getCityList() - { - return array_keys(self::$cities); - } -} diff --git a/library/Zend/Date/DateObject.php b/library/Zend/Date/DateObject.php deleted file mode 100644 index 5219b68dc..000000000 --- a/library/Zend/Date/DateObject.php +++ /dev/null @@ -1,1139 +0,0 @@ - 0, 1960 => -315_619_200, 1950 => -631_152_000, - 1940 => -946_771_200, 1930 => -1_262_304_000, 1920 => -1_577_923_200, - 1910 => -1_893_456_000, 1900 => -2_208_988_800, 1890 => -2_524_521_600, - 1880 => -2_840_140_800, 1870 => -3_155_673_600, 1860 => -3_471_292_800, - 1850 => -3_786_825_600, 1840 => -4_102_444_800, 1830 => -4_417_977_600, - 1820 => -4_733_596_800, 1810 => -5_049_129_600, 1800 => -5_364_662_400, - 1790 => -5_680_195_200, 1780 => -5_995_814_400, 1770 => -6_311_347_200, - 1760 => -6_626_966_400, 1750 => -6_942_499_200, 1740 => -7_258_118_400, - 1730 => -7_573_651_200, 1720 => -7_889_270_400, 1710 => -8_204_803_200, - 1700 => -8_520_336_000, 1690 => -8_835_868_800, 1680 => -9_151_488_000, - 1670 => -9_467_020_800, 1660 => -9_782_640_000, 1650 => -10_098_172_800, - 1640 => -10_413_792_000, 1630 => -10_729_324_800, 1620 => -11_044_944_000, - 1610 => -11_360_476_800, 1600 => -11_676_096_000, ]; - - /** - * Set this object to have a new UNIX timestamp. - * - * @param int|string $timestamp OPTIONAL timestamp; defaults to local time using time() - * - * @return int|string old timestamp - */ - protected function setUnixTimestamp($timestamp = null) - { - $old = $this->_unixTimestamp; - - if (is_numeric($timestamp)) { - $this->_unixTimestamp = $timestamp; - } elseif ($timestamp === null) { - $this->_unixTimestamp = time(); - } else { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception('\'' . $timestamp . '\' is not a valid UNIX timestamp', 0, null, $timestamp); - } - - return $old; - } - - /** - * Returns this object's UNIX timestamp - * A timestamp greater then the integer range will be returned as string - * This function does not return the timestamp as object. Use copy() instead. - * - * @return int|string timestamp - */ - protected function getUnixTimestamp() - { - if ($this->_unixTimestamp === intval($this->_unixTimestamp)) { - return (int) $this->_unixTimestamp; - } - - return (string) $this->_unixTimestamp; - } - - /** - * Internal function. - * Returns time(). This method exists to allow unit tests to work-around methods that might otherwise - * be hard-coded to use time(). For example, this makes it possible to test isYesterday() in Date.php. - * - * @param int $sync OPTIONAL time syncronisation value - * - * @return int timestamp - */ - protected function _getTime($sync = null) - { - if ($sync !== null) { - $this->_syncronised = round($sync); - } - - return time() + $this->_syncronised; - } - - /** - * Internal mktime function used by Zend_Date. - * The timestamp returned by mktime() can exceed the precision of traditional UNIX timestamps, - * by allowing PHP to auto-convert to using a float value. - * - * Returns a timestamp relative to 1970/01/01 00:00:00 GMT/UTC. - * DST (Summer/Winter) is depriciated since php 5.1.0. - * Year has to be 4 digits otherwise it would be recognised as - * year 70 AD instead of 1970 AD as expected !! - * - * @param int $hour - * @param int $minute - * @param int $second - * @param int $month - * @param int $day - * @param int $year - * @param bool $gmt OPTIONAL true = other arguments are for UTC time, false = arguments are for local time/date - * - * @return float|int timestamp (number of seconds elapsed relative to 1970/01/01 00:00:00 GMT/UTC) - */ - protected function mktime($hour, $minute, $second, $month, $day, $year, $gmt = false) - { - $id = null; - // complete date but in 32bit timestamp - use PHP internal - if ((1901 < $year) and ($year < 2038)) { - $oldzone = @date_default_timezone_get(); - // Timezone also includes DST settings, therefor substracting the GMT offset is not enough - // We have to set the correct timezone to get the right value - if (($this->_timezone != $oldzone) and ($gmt === false)) { - date_default_timezone_set($this->_timezone); - } - $result = ($gmt) ? @gmmktime($hour, $minute, $second, (int) $month, $day, $year) - : @mktime($hour, $minute, $second,(int) $month, $day, $year); - date_default_timezone_set($oldzone); - - return $result; - } - - if ($gmt !== true) { - $second += $this->_offset; - } - - if (isset(self::$_cache)) { - $id = strtr('Zend_DateObject_mkTime_' . $this->_offset . '_' . $year . $month . $day . '_' . $hour . $minute . $second . '_' . (int) $gmt, '-','_'); - if ($result = self::$_cache->load($id)) { - return unserialize($result); - } - } - - // date to integer - $day = intval($day); - $month = intval($month); - $year = intval($year); - - // correct months > 12 and months < 1 - if ($month > 12) { - $overlap = floor($month / 12); - $year += $overlap; - $month -= $overlap * 12; - } else { - $overlap = ceil((1 - $month) / 12); - $year -= $overlap; - $month += $overlap * 12; - } - - $date = 0; - if ($year >= 1970) { - // Date is after UNIX epoch - // go through leapyears - // add months from latest given year - for ($count = 1970; $count <= $year; ++$count) { - $leapyear = self::isYearLeapYear($count); - if ($count < $year) { - $date += 365; - if ($leapyear === true) { - ++$date; - } - } else { - for ($mcount = 0; $mcount < ($month - 1); ++$mcount) { - $date += self::$_monthTable[$mcount]; - if (($leapyear === true) and ($mcount == 1)) { - ++$date; - } - } - } - } - - $date += $day - 1; - $date = (($date * 86400) + ($hour * 3600) + ($minute * 60) + $second); - } else { - // Date is before UNIX epoch - // go through leapyears - // add months from latest given year - for ($count = 1969; $count >= $year; --$count) { - $leapyear = self::isYearLeapYear($count); - if ($count > $year) { - $date += 365; - if ($leapyear === true) { - ++$date; - } - } else { - for ($mcount = 11; $mcount > ($month - 1); --$mcount) { - $date += self::$_monthTable[$mcount]; - if (($leapyear === true) and ($mcount == 2)) { - ++$date; - } - } - } - } - - $date += (self::$_monthTable[$month - 1] - $day); - $date = -(($date * 86400) + (86400 - (($hour * 3600) + ($minute * 60) + $second))); - - // gregorian correction for 5.Oct.1582 - if ($date < -12_220_185_600) { - $date += 864000; - } elseif ($date < -12_219_321_600) { - $date = -12_219_321_600; - } - } - - if (isset(self::$_cache)) { - if (self::$_cacheTags) { - self::$_cache->save(serialize($date), $id, [\Zend_Date::class]); - } else { - self::$_cache->save(serialize($date), $id); - } - } - - return $date; - } - - /** - * Returns true, if given $year is a leap year. - * - * @param int $year - * - * @return bool true, if year is leap year - */ - protected static function isYearLeapYear($year) - { - $year = (int) $year; - // all leapyears can be divided through 4 - if (($year % 4) != 0) { - return false; - } - - // all leapyears can be divided through 400 - if ($year % 400 == 0) { - return true; - } - if (($year > 1582) and ($year % 100 == 0)) { - return false; - } - - return true; - } - - /** - * Internal mktime function used by Zend_Date for handling 64bit timestamps. - * - * Returns a formatted date for a given timestamp. - * - * @param string $format format for output - * @param mixed $timestamp - * @param bool $gmt OPTIONAL true = other arguments are for UTC time, false = arguments are for local time/date - * - * @return string - */ - protected function date($format, $timestamp = null, $gmt = false) - { - $idstamp = null; - $oldzone = @date_default_timezone_get(); - if ($this->_timezone != $oldzone) { - date_default_timezone_set($this->_timezone); - } - - if ($timestamp === null) { - $result = ($gmt) ? @gmdate($format) : @date($format); - date_default_timezone_set($oldzone); - - return $result; - } - - if (abs($timestamp) <= 0x7FFFFFFF) { - // See ZF-11992 - // "o" will sometimes resolve to the previous year (see - // http://php.net/date ; it's part of the ISO 8601 - // standard). However, this is not desired, so replacing - // all occurrences of "o" not preceded by a backslash - // with "Y" - $format = preg_replace('/(?_offset . '_' . $timestamp . '_' . (int) $gmt, '-','_'); - if ($result2 = self::$_cache->load($idstamp)) { - $timestamp = unserialize($result2); - $jump = true; - } - } - - // check on false or null alone fails - if (empty($gmt) and empty($jump)) { - $tempstamp = $timestamp; - if ($tempstamp > 0) { - while (abs($tempstamp) > 0x7FFFFFFF) { - $tempstamp -= (86400 * 23376); - } - - $dst = date('I', $tempstamp); - if ($dst === 1) { - $timestamp += 3600; - } - - $temp = date('Z', $tempstamp); - $timestamp += $temp; - } - - if (isset(self::$_cache)) { - if (self::$_cacheTags) { - self::$_cache->save(serialize($timestamp), $idstamp, [\Zend_Date::class]); - } else { - self::$_cache->save(serialize($timestamp), $idstamp); - } - } - } - - if (($timestamp < 0) and ($gmt !== true)) { - $timestamp -= $this->_offset; - } - - date_default_timezone_set($oldzone); - $date = $this->getDateParts($timestamp, true); - $length = strlen($format); - $output = ''; - - for ($i = 0; $i < $length; ++$i) { - switch ($format[$i]) { - // day formats - case 'd': // day of month, 2 digits, with leading zero, 01 - 31 - $output .= (($date['mday'] < 10) ? '0' . $date['mday'] : $date['mday']); - - break; - - case 'D': // day of week, 3 letters, Mon - Sun - $output .= date('D', 86400 * (3 + self::dayOfWeek($date['year'], $date['mon'], $date['mday']))); - - break; - - case 'j': // day of month, without leading zero, 1 - 31 - $output .= $date['mday']; - - break; - - case 'l': // day of week, full string name, Sunday - Saturday - $output .= date('l', 86400 * (3 + self::dayOfWeek($date['year'], $date['mon'], $date['mday']))); - - break; - - case 'N': // ISO 8601 numeric day of week, 1 - 7 - $day = self::dayOfWeek($date['year'], $date['mon'], $date['mday']); - if ($day == 0) { - $day = 7; - } - $output .= $day; - - break; - - case 'S': // english suffix for day of month, st nd rd th - if (($date['mday'] % 10) == 1) { - $output .= 'st'; - } elseif ((($date['mday'] % 10) == 2) and ($date['mday'] != 12)) { - $output .= 'nd'; - } elseif (($date['mday'] % 10) == 3) { - $output .= 'rd'; - } else { - $output .= 'th'; - } - - break; - - case 'w': // numeric day of week, 0 - 6 - $output .= self::dayOfWeek($date['year'], $date['mon'], $date['mday']); - - break; - - case 'z': // day of year, 0 - 365 - $output .= $date['yday']; - - break; - - // week formats - case 'W': // ISO 8601, week number of year - $output .= $this->weekNumber($date['year'], $date['mon'], $date['mday']); - - break; - - // month formats - case 'F': // string month name, january - december - $output .= date('F', mktime(0, 0, 0, $date['mon'], 2, 1971)); - - break; - - case 'm': // number of month, with leading zeros, 01 - 12 - $output .= (($date['mon'] < 10) ? '0' . $date['mon'] : $date['mon']); - - break; - - case 'M': // 3 letter month name, Jan - Dec - $output .= date('M',mktime(0, 0, 0, $date['mon'], 2, 1971)); - - break; - - case 'n': // number of month, without leading zeros, 1 - 12 - $output .= $date['mon']; - - break; - - case 't': // number of day in month - $output .= self::$_monthTable[$date['mon'] - 1]; - - break; - - // year formats - case 'L': // is leap year ? - $output .= (self::isYearLeapYear($date['year'])) ? '1' : '0'; - - break; - - case 'o': // ISO 8601 year number - $week = $this->weekNumber($date['year'], $date['mon'], $date['mday']); - if (($week > 50) and ($date['mon'] == 1)) { - $output .= ($date['year'] - 1); - } else { - $output .= $date['year']; - } - - break; - - case 'Y': // year number, 4 digits - $output .= $date['year']; - - break; - - case 'y': // year number, 2 digits - $output .= substr($date['year'], strlen($date['year']) - 2, 2); - - break; - - // time formats - case 'a': // lower case am/pm - $output .= (($date['hours'] >= 12) ? 'pm' : 'am'); - - break; - - case 'A': // upper case am/pm - $output .= (($date['hours'] >= 12) ? 'PM' : 'AM'); - - break; - - case 'B': // swatch internet time - $dayseconds = ($date['hours'] * 3600) + ($date['minutes'] * 60) + $date['seconds']; - if ($gmt === true) { - $dayseconds += 3600; - } - $output .= (int) (($dayseconds % 86400) / 86.4); - - break; - - case 'g': // hours without leading zeros, 12h format - if ($date['hours'] > 12) { - $hour = $date['hours'] - 12; - } else { - if ($date['hours'] == 0) { - $hour = '12'; - } else { - $hour = $date['hours']; - } - } - $output .= $hour; - - break; - - case 'G': // hours without leading zeros, 24h format - $output .= $date['hours']; - - break; - - case 'h': // hours with leading zeros, 12h format - if ($date['hours'] > 12) { - $hour = $date['hours'] - 12; - } else { - if ($date['hours'] == 0) { - $hour = '12'; - } else { - $hour = $date['hours']; - } - } - $output .= (($hour < 10) ? '0' . $hour : $hour); - - break; - - case 'H': // hours with leading zeros, 24h format - $output .= (($date['hours'] < 10) ? '0' . $date['hours'] : $date['hours']); - - break; - - case 'i': // minutes with leading zeros - $output .= (($date['minutes'] < 10) ? '0' . $date['minutes'] : $date['minutes']); - - break; - - case 's': // seconds with leading zeros - $output .= (($date['seconds'] < 10) ? '0' . $date['seconds'] : $date['seconds']); - - break; - - // timezone formats - case 'e': // timezone identifier - if ($gmt === true) { - $output .= gmdate('e', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } else { - $output .= date('e', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } - - break; - - case 'I': // daylight saving time or not - if ($gmt === true) { - $output .= gmdate('I', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } else { - $output .= date('I', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } - - break; - - case 'O': // difference to GMT in hours - $gmtstr = ($gmt === true) ? 0 : $this->getGmtOffset(); - $output .= sprintf('%s%04d', ($gmtstr <= 0) ? '+' : '-', abs($gmtstr) / 36); - - break; - - case 'P': // difference to GMT with colon - $gmtstr = ($gmt === true) ? 0 : $this->getGmtOffset(); - $gmtstr = sprintf('%s%04d', ($gmtstr <= 0) ? '+' : '-', abs($gmtstr) / 36); - $output = $output . substr($gmtstr, 0, 3) . ':' . substr($gmtstr, 3); - - break; - - case 'T': // timezone settings - if ($gmt === true) { - $output .= gmdate('T', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } else { - $output .= date('T', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } - - break; - - case 'Z': // timezone offset in seconds - $output .= ($gmt === true) ? 0 : -$this->getGmtOffset(); - - break; - - // complete time formats - case 'c': // ISO 8601 date format - $difference = $this->getGmtOffset(); - $difference = sprintf('%s%04d', ($difference <= 0) ? '+' : '-', abs($difference) / 36); - $difference = substr($difference, 0, 3) . ':' . substr($difference, 3); - $output .= $date['year'] . '-' - . (($date['mon'] < 10) ? '0' . $date['mon'] : $date['mon']) . '-' - . (($date['mday'] < 10) ? '0' . $date['mday'] : $date['mday']) . 'T' - . (($date['hours'] < 10) ? '0' . $date['hours'] : $date['hours']) . ':' - . (($date['minutes'] < 10) ? '0' . $date['minutes'] : $date['minutes']) . ':' - . (($date['seconds'] < 10) ? '0' . $date['seconds'] : $date['seconds']) - . $difference; - - break; - - case 'r': // RFC 2822 date format - $difference = $this->getGmtOffset(); - $difference = sprintf('%s%04d', ($difference <= 0) ? '+' : '-', abs($difference) / 36); - $output .= gmdate('D', 86400 * (3 + self::dayOfWeek($date['year'], $date['mon'], $date['mday']))) . ', ' - . (($date['mday'] < 10) ? '0' . $date['mday'] : $date['mday']) . ' ' - . date('M', mktime(0, 0, 0, $date['mon'], 2, 1971)) . ' ' - . $date['year'] . ' ' - . (($date['hours'] < 10) ? '0' . $date['hours'] : $date['hours']) . ':' - . (($date['minutes'] < 10) ? '0' . $date['minutes'] : $date['minutes']) . ':' - . (($date['seconds'] < 10) ? '0' . $date['seconds'] : $date['seconds']) . ' ' - . $difference; - - break; - - case 'U': // Unix timestamp - $output .= $origstamp; - - break; - - // special formats - case '\\': // next letter to print with no format - $i++; - if ($i < $length) { - $output .= $format[$i]; - } - - break; - - default: // letter is no format so add it direct - $output .= $format[$i]; - - break; - } - } - - return (string) $output; - } - - /** - * Returns the day of week for a Gregorian calendar date. - * 0 = sunday, 6 = saturday. - * - * @param int $year - * @param int $month - * @param int $day - * - * @return int dayOfWeek - */ - protected static function dayOfWeek($year, $month, $day) - { - if ((1901 < $year) and ($year < 2038)) { - return (int) date('w', mktime(0, 0, 0, $month, $day, $year)); - } - - // gregorian correction - $correction = 0; - if (($year < 1582) or (($year == 1582) and (($month < 10) or (($month == 10) && ($day < 15))))) { - $correction = 3; - } - - if ($month > 2) { - $month -= 2; - } else { - $month += 10; - --$year; - } - - $day = floor((13 * $month - 1) / 5) + $day + ($year % 100) + floor(($year % 100) / 4); - $day += floor(($year / 100) / 4) - 2 * floor($year / 100) + 77 + $correction; - - return (int) ($day - 7 * floor($day / 7)); - } - - /** - * Internal getDateParts function for handling 64bit timestamps, similar to: - * http://www.php.net/getdate. - * - * Returns an array of date parts for $timestamp, relative to 1970/01/01 00:00:00 GMT/UTC. - * - * $fast specifies ALL date parts should be returned (slower) - * Default is false, and excludes $dayofweek, weekday, month and timestamp from parts returned. - * - * @param mixed $timestamp - * @param bool $fast OPTIONAL defaults to fast (false), resulting in fewer date parts - * - * @return array - */ - protected function getDateParts($timestamp = null, $fast = null) - { - $year = null; - $id = null; - // actual timestamp - if (!is_numeric($timestamp)) { - return getdate(); - } - - // 32bit timestamp - if (abs($timestamp) <= 0x7FFFFFFF) { - return @getdate((int) $timestamp); - } - - if (isset(self::$_cache)) { - $id = strtr('Zend_DateObject_getDateParts_' . $timestamp . '_' . (int) $fast, '-','_'); - if ($result = self::$_cache->load($id)) { - return unserialize($result); - } - } - - $otimestamp = $timestamp; - $numday = 0; - $month = 0; - // gregorian correction - if ($timestamp < -12_219_321_600) { - $timestamp -= 864000; - } - - // timestamp lower 0 - if ($timestamp < 0) { - $sec = 0; - $act = 1970; - - // iterate through 10 years table, increasing speed - foreach (self::$_yearTable as $year => $seconds) { - if ($timestamp >= $seconds) { - $i = $act; - - break; - } - $sec = $seconds; - $act = $year; - } - - $timestamp -= $sec; - if (!isset($i)) { - $i = $act; - } - - // iterate the max last 10 years - do { - --$i; - $day = $timestamp; - - $timestamp += 31_536_000; - $leapyear = self::isYearLeapYear($i); - if ($leapyear === true) { - $timestamp += 86400; - } - - if ($timestamp >= 0) { - $year = $i; - - break; - } - } while ($timestamp < 0); - - $secondsPerYear = 86400 * ($leapyear ? 366 : 365) + $day; - - $timestamp = $day; - // iterate through months - for ($i = 12; --$i >= 0;) { - $day = $timestamp; - - $timestamp += self::$_monthTable[$i] * 86400; - if (($leapyear === true) and ($i == 1)) { - $timestamp += 86400; - } - - if ($timestamp >= 0) { - $month = $i; - $numday = self::$_monthTable[$i]; - if (($leapyear === true) and ($i == 1)) { - ++$numday; - } - - break; - } - } - - $timestamp = $day; - $numberdays = $numday + ceil(($timestamp + 1) / 86400); - - $timestamp += ($numday - $numberdays + 1) * 86400; - $hours = floor($timestamp / 3600); - } else { - // iterate through years - for ($i = 1970; ; ++$i) { - $day = $timestamp; - - $timestamp -= 31_536_000; - $leapyear = self::isYearLeapYear($i); - if ($leapyear === true) { - $timestamp -= 86400; - } - - if ($timestamp < 0) { - $year = $i; - - break; - } - } - - $secondsPerYear = $day; - - $timestamp = $day; - // iterate through months - for ($i = 0; $i <= 11; ++$i) { - $day = $timestamp; - $timestamp -= self::$_monthTable[$i] * 86400; - - if (($leapyear === true) and ($i == 1)) { - $timestamp -= 86400; - } - - if ($timestamp < 0) { - $month = $i; - $numday = self::$_monthTable[$i]; - if (($leapyear === true) and ($i == 1)) { - ++$numday; - } - - break; - } - } - - $timestamp = $day; - $numberdays = ceil(($timestamp + 1) / 86400); - $timestamp = $timestamp - ($numberdays - 1) * 86400; - $hours = floor($timestamp / 3600); - } - - $timestamp -= $hours * 3600; - - ++$month; - $minutes = floor($timestamp / 60); - $seconds = $timestamp - $minutes * 60; - - if ($fast === true) { - $array = [ - 'seconds' => $seconds, - 'minutes' => $minutes, - 'hours' => $hours, - 'mday' => $numberdays, - 'mon' => $month, - 'year' => $year, - 'yday' => floor($secondsPerYear / 86400), - ]; - } else { - $dayofweek = self::dayOfWeek($year, $month, $numberdays); - $array = [ - 'seconds' => $seconds, - 'minutes' => $minutes, - 'hours' => $hours, - 'mday' => $numberdays, - 'wday' => $dayofweek, - 'mon' => $month, - 'year' => $year, - 'yday' => floor($secondsPerYear / 86400), - 'weekday' => gmdate('l', 86400 * (3 + $dayofweek)), - 'month' => gmdate('F', mktime(0, 0, 0, $month, 1, 1971)), - 0 => $otimestamp, - ]; - } - - if (isset(self::$_cache)) { - if (self::$_cacheTags) { - self::$_cache->save(serialize($array), $id, [\Zend_Date::class]); - } else { - self::$_cache->save(serialize($array), $id); - } - } - - return $array; - } - - /** - * Internal getWeekNumber function for handling 64bit timestamps. - * - * Returns the ISO 8601 week number of a given date - * - * @param int $year - * @param int $month - * @param int $day - * - * @return int - */ - protected function weekNumber($year, $month, $day) - { - if ((1901 < $year) and ($year < 2038)) { - return (int) date('W', mktime(0, 0, 0, $month, $day, $year)); - } - - $dayofweek = self::dayOfWeek($year, $month, $day); - $firstday = self::dayOfWeek($year, 1, 1); - if (($month == 1) and (($firstday < 1) or ($firstday > 4)) and ($day < 4)) { - $firstday = self::dayOfWeek($year - 1, 1, 1); - $month = 12; - $day = 31; - } elseif (($month == 12) and ((self::dayOfWeek($year + 1, 1, 1) < 5) - and (self::dayOfWeek($year + 1, 1, 1) > 0))) { - return 1; - } - - return intval(((self::dayOfWeek($year, 1, 1) < 5) and (self::dayOfWeek($year, 1, 1) > 0)) - + 4 * ($month - 1) + (2 * ($month - 1) + ($day - 1) + $firstday - $dayofweek + 6) * 36 / 256); - } - - /** - * Internal _range function - * Sets the value $a to be in the range of [0, $b]. - * - * @param float $a - value to correct - * @param float $b - maximum range to set - */ - private function _range($a, $b) - { - while ($a < 0) { - $a += $b; - } - while ($a >= $b) { - $a -= $b; - } - - return $a; - } - - /** - * Calculates the sunrise or sunset based on a location. - * - * @param array $location Location for calculation MUST include 'latitude', 'longitude', 'horizon' - * @param bool $horizon true: sunrise; false: sunset - * @param mixed $rise - * - * @return mixed - false: midnight sun, integer: - */ - protected function calcSun($location, $horizon, $rise = false) - { - // timestamp within 32bit - if (abs($this->_unixTimestamp) <= 0x7FFFFFFF) { - if ($rise === false) { - return date_sunset($this->_unixTimestamp, SUNFUNCS_RET_TIMESTAMP, $location['latitude'], - $location['longitude'], 90 + $horizon, $this->getGmtOffset() / 3600); - } - - return date_sunrise($this->_unixTimestamp, SUNFUNCS_RET_TIMESTAMP, $location['latitude'], - $location['longitude'], 90 + $horizon, $this->getGmtOffset() / 3600); - } - - // self calculation - timestamp bigger than 32bit - // fix circle values - $quarterCircle = 0.5 * M_PI; - $halfCircle = M_PI; - $threeQuarterCircle = 1.5 * M_PI; - $fullCircle = 2 * M_PI; - - // radiant conversion for coordinates - $radLatitude = $location['latitude'] * $halfCircle / 180; - $radLongitude = $location['longitude'] * $halfCircle / 180; - - // get solar coordinates - $tmpRise = $rise ? $quarterCircle : $threeQuarterCircle; - $radDay = $this->date('z',$this->_unixTimestamp) + ($tmpRise - $radLongitude) / $fullCircle; - - // solar anomoly and longitude - $solAnomoly = $radDay * 0.017202 - 0.0574039; - $solLongitude = $solAnomoly + 0.0334405 * sin($solAnomoly); - $solLongitude += 4.93289 + 3.49066E-4 * sin(2 * $solAnomoly); - - // get quadrant - $solLongitude = $this->_range($solLongitude, $fullCircle); - - if (($solLongitude / $quarterCircle) - intval($solLongitude / $quarterCircle) == 0) { - $solLongitude += 4.84814E-6; - } - - // solar ascension - $solAscension = sin($solLongitude) / cos($solLongitude); - $solAscension = atan2(0.91746 * $solAscension, 1); - - // adjust quadrant - if ($solLongitude > $threeQuarterCircle) { - $solAscension += $fullCircle; - } elseif ($solLongitude > $quarterCircle) { - $solAscension += $halfCircle; - } - - // solar declination - $solDeclination = 0.39782 * sin($solLongitude); - $solDeclination /= sqrt(-$solDeclination * $solDeclination + 1); - $solDeclination = atan2($solDeclination, 1); - - $solHorizon = $horizon - sin($solDeclination) * sin($radLatitude); - $solHorizon /= cos($solDeclination) * cos($radLatitude); - - // midnight sun, always night - if (abs($solHorizon) > 1) { - return false; - } - - $solHorizon /= sqrt(-$solHorizon * $solHorizon + 1); - $solHorizon = $quarterCircle - atan2($solHorizon, 1); - - if ($rise) { - $solHorizon = $fullCircle - $solHorizon; - } - - // time calculation - $localTime = $solHorizon + $solAscension - 0.0172028 * $radDay - 1.73364; - $universalTime = $localTime - $radLongitude; - - // determinate quadrant - $universalTime = $this->_range($universalTime, $fullCircle); - - // radiant to hours - $universalTime *= 24 / $fullCircle; - - // convert to time - $hour = intval($universalTime); - $universalTime = ($universalTime - $hour) * 60; - $min = intval($universalTime); - $universalTime = ($universalTime - $min) * 60; - $sec = intval($universalTime); - - return $this->mktime($hour, $min, $sec, $this->date('m', $this->_unixTimestamp), - $this->date('j', $this->_unixTimestamp), $this->date('Y', $this->_unixTimestamp), - -1); - } - - /** - * Sets a new timezone for calculation of $this object's gmt offset. - * For a list of supported timezones look here: http://php.net/timezones - * If no timezone can be detected or the given timezone is wrong UTC will be set. - * - * @param string $zone OPTIONAL timezone for date calculation; defaults to date_default_timezone_get() - * - * @return Zend_Date_DateObject Provides fluent interface - */ - public function setTimezone($zone = null) - { - $oldzone = @date_default_timezone_get(); - if ($zone === null) { - $zone = $oldzone; - } - - // throw an error on false input, but only if the new date extension is available - if (function_exists('timezone_open')) { - if (!@timezone_open($zone)) { - require_once 'Zend/Date/Exception.php'; - - throw new Zend_Date_Exception("timezone ($zone) is not a known timezone", 0, null, $zone); - } - } - // this can generate an error if the date extension is not available and a false timezone is given - $result = @date_default_timezone_set($zone); - if ($result === true) { - $this->_offset = mktime(0, 0, 0, 1, 2, 1970) - gmmktime(0, 0, 0, 1, 2, 1970); - $this->_timezone = $zone; - } - date_default_timezone_set($oldzone); - - if (($zone == 'UTC') or ($zone == 'GMT')) { - $this->_dst = false; - } else { - $this->_dst = true; - } - - return $this; - } - - /** - * Return the timezone of $this object. - * The timezone is initially set when the object is instantiated. - * - * @return string actual set timezone string - */ - public function getTimezone() - { - return $this->_timezone; - } - - /** - * Return the offset to GMT of $this object's timezone. - * The offset to GMT is initially set when the object is instantiated using the currently, - * in effect, default timezone for PHP functions. - * - * @return int seconds difference between GMT timezone and timezone when object was instantiated - */ - public function getGmtOffset() - { - $offset = null; - $date = $this->getDateParts($this->getUnixTimestamp(), true); - $zone = @date_default_timezone_get(); - $result = @date_default_timezone_set($this->_timezone); - if ($result === true) { - $offset = $this->mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], $date['year'], false) - - $this->mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], $date['year'], true); - } - date_default_timezone_set($zone); - - return $offset; - } - - /** - * Internal method to check if the given cache supports tags. - */ - protected static function _getTagSupportForCache() - { - $backend = self::$_cache->getBackend(); - if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) { - $cacheOptions = $backend->getCapabilities(); - self::$_cacheTags = $cacheOptions['tags']; - } else { - self::$_cacheTags = false; - } - - return self::$_cacheTags; - } -} diff --git a/library/Zend/Date/Exception.php b/library/Zend/Date/Exception.php deleted file mode 100644 index 19034c4e5..000000000 --- a/library/Zend/Date/Exception.php +++ /dev/null @@ -1,43 +0,0 @@ -operand = $op; - parent::__construct($message, $code, $e); - } - - public function getOperand() - { - return $this->operand; - } -} diff --git a/library/Zend/Exception.php b/library/Zend/Exception.php index e6a245c92..46aecc974 100644 --- a/library/Zend/Exception.php +++ b/library/Zend/Exception.php @@ -1,4 +1,5 @@ setInfoClass(\Zend_File_PhpClassFile::class); + $this->setInfoClass(Zend_File_PhpClassFile::class); } /** diff --git a/library/Zend/File/PhpClassFile.php b/library/Zend/File/PhpClassFile.php index 32875931f..443e2c02c 100644 --- a/library/Zend/File/PhpClassFile.php +++ b/library/Zend/File/PhpClassFile.php @@ -1,4 +1,5 @@ _adapter[$direction] = new $adapter($options); if (!$this->_adapter[$direction] instanceof Zend_File_Transfer_Adapter_Abstract) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Adapter ' . $adapter . ' does not extend Zend_File_Transfer_Adapter_Abstract'); } @@ -117,8 +111,6 @@ public function __call($method, array $options) return call_user_func_array([$this->_adapter[$direction], $method], $options); } - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("Unknown method '" . $method . "' called!"); } } diff --git a/library/Zend/File/Transfer/Adapter/Abstract.php b/library/Zend/File/Transfer/Adapter/Abstract.php index e532d4495..2f9cf71e7 100644 --- a/library/Zend/File/Transfer/Adapter/Abstract.php +++ b/library/Zend/File/Transfer/Adapter/Abstract.php @@ -1,4 +1,5 @@ 'Zend/' . $pathSegment . '/File', ]; - require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader($paths); } else { $loader = $this->_loaders[$type]; @@ -239,8 +223,6 @@ public function getPluginLoader($type) return $this->_loaders[$type]; default: - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -284,8 +266,6 @@ public function addPrefixPath($prefix, $path, $type = null) return $this; default: - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -359,8 +339,6 @@ public function addValidator($validator, $breakChainOnFailure = false, $options unset($options['messages']); } } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Invalid validator provided to addValidator; must be string or Zend_Validate_Interface'); } @@ -447,8 +425,6 @@ public function addValidators(array $validators, $files = null) } } } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Invalid validator passed to addValidators()'); } } @@ -608,8 +584,6 @@ public function setOptions($options = [], $files = null) break; default: - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("Unknown option: $name = $value"); } } @@ -657,13 +631,12 @@ public function isValid($files = null) return false; } - $translator = $this->getTranslator(); $this->_messages = []; $break = false; foreach ($check as $key => $content) { if (array_key_exists('validators', $content) - && in_array(\Zend_Validate_File_Count::class, $content['validators'])) { - $validator = $this->_validators[\Zend_Validate_File_Count::class]; + && in_array(Zend_Validate_File_Count::class, $content['validators'])) { + $validator = $this->_validators[Zend_Validate_File_Count::class]; $count = $content; if (empty($content['tmp_name'])) { continue; @@ -695,11 +668,8 @@ public function isValid($files = null) if (array_key_exists('validators', $content)) { foreach ($content['validators'] as $class) { $validator = $this->_validators[$class]; - if (method_exists($validator, 'setTranslator')) { - $validator->setTranslator($translator); - } - if (($class === \Zend_Validate_File_Upload::class) and (empty($content['tmp_name']))) { + if (($class === Zend_Validate_File_Upload::class) and (empty($content['tmp_name']))) { $tocheck = $key; } else { $tocheck = $content['tmp_name']; @@ -715,7 +685,7 @@ public function isValid($files = null) break; } - if (($class === \Zend_Validate_File_Upload::class) and ((is_countable($fileerrors) ? count($fileerrors) : 0) > 0)) { + if (($class === Zend_Validate_File_Upload::class) and ((is_countable($fileerrors) ? count($fileerrors) : 0) > 0)) { break; } @@ -779,7 +749,7 @@ public function hasErrors() /** * Adds a new filter for this class. * - * @param array|string $filter Type of filter to add + * @param array|string|Zend_Filter_Interface $filter Type of filter to add * @param array|string $options Options to set for the filter * @param array|string $files Files to limit this filter to * @@ -793,8 +763,6 @@ public function addFilter($filter, $options = null, $files = null) $class = $this->getPluginLoader(self::FILTER)->load($filter); $filter = new $class($options); } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Invalid filter specified'); } @@ -979,8 +947,6 @@ public function clearFilters() */ public function getFile() { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -1039,8 +1005,6 @@ public function getFileInfo($file = null) */ public function addFile($file, $validator = null, $filter = null) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -1051,8 +1015,6 @@ public function addFile($file, $validator = null, $filter = null) */ public function getType() { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -1067,8 +1029,6 @@ public function getType() */ public function addType($type, $validator = null, $filter = null) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -1087,16 +1047,12 @@ public function setDestination($destination, $files = null) $orig = $files; $destination = rtrim($destination, '/\\'); if (!is_dir($destination)) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception( 'The given destination is not a directory or does not exist' ); } if (!$this->_isPathWriteable($destination)) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception( 'The given destination is not writable' ); @@ -1136,8 +1092,6 @@ public function getDestination($files = null) if (isset($this->_files[$orig]['destination'])) { $destinations[$orig] = $this->_files[$orig]['destination']; } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception(sprintf('The file transfer adapter can not find "%s"', $orig)); } } @@ -1161,68 +1115,6 @@ public function getDestination($files = null) return $destinations; } - /** - * Set translator object for localization. - * - * @param null|Zend_Translate $translator - * - * @return Zend_File_Transfer_Abstract - */ - public function setTranslator($translator = null) - { - if (null === $translator) { - $this->_translator = null; - } elseif ($translator instanceof Zend_Translate_Adapter) { - $this->_translator = $translator; - } elseif ($translator instanceof Zend_Translate) { - $this->_translator = $translator->getAdapter(); - } else { - require_once 'Zend/File/Transfer/Exception.php'; - - throw new Zend_File_Transfer_Exception('Invalid translator specified'); - } - - return $this; - } - - /** - * Retrieve localization translator object. - * - * @return null|Zend_Translate_Adapter - */ - public function getTranslator() - { - if ($this->translatorIsDisabled()) { - return null; - } - - return $this->_translator; - } - - /** - * Indicate whether or not translation should be disabled. - * - * @param bool $flag - * - * @return Zend_File_Transfer_Abstract - */ - public function setDisableTranslator($flag) - { - $this->_translatorDisabled = (bool) $flag; - - return $this; - } - - /** - * Is translation disabled? - * - * @return bool - */ - public function translatorIsDisabled() - { - return $this->_translatorDisabled; - } - /** * Returns the hash for a given file. * @@ -1234,8 +1126,6 @@ public function translatorIsDisabled() public function getHash($hash = 'crc32', $files = null) { if (!in_array($hash, hash_algos())) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Unknown hash algorithm'); } @@ -1247,8 +1137,6 @@ public function getHash($hash = 'crc32', $files = null) } elseif (file_exists($value['tmp_name'])) { $result[$key] = hash_file($hash, $value['tmp_name']); } elseif (empty($value['options']['ignoreNoFile'])) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("The file '{$value['name']}' does not exist"); } } @@ -1279,8 +1167,6 @@ public function getFileSize($files = null) $result[$key] = $value['size']; } } elseif (empty($value['options']['ignoreNoFile'])) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("The file '{$value['name']}' does not exist"); } else { continue; @@ -1330,8 +1216,6 @@ public function getMimeType($files = null) if (file_exists($value['name']) || file_exists($value['tmp_name'])) { $result[$key] = $value['type']; } elseif (empty($value['options']['ignoreNoFile'])) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("The file '{$value['name']}' does not exist"); } else { continue; @@ -1362,7 +1246,7 @@ protected function _detectMimeType($value) return null; } - if (class_exists(\finfo::class, false)) { + if (class_exists(finfo::class, false)) { $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; if (!empty($value['options']['magicFile'])) { $mime = @finfo_open($const, $value['options']['magicFile']); @@ -1485,8 +1369,6 @@ protected function _getTmpDir() $this->_tmpDir = realpath(dirname($tempFile)); unlink($tempFile); } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Could not determine a temporary directory'); } } @@ -1575,8 +1457,6 @@ protected function _getFiles($files, $names = false, $noexception = false) return []; } - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception(sprintf('The file transfer adapter can not find "%s"', $find)); } diff --git a/library/Zend/File/Transfer/Adapter/Http.php b/library/Zend/File/Transfer/Adapter/Http.php index db43f6465..a638e555a 100644 --- a/library/Zend/File/Transfer/Adapter/Http.php +++ b/library/Zend/File/Transfer/Adapter/Http.php @@ -1,4 +1,5 @@ [ 'name' => $files, 'error' => 1, ]]; - $validator = $this->_validators[\Zend_Validate_File_Upload::class]; + $validator = $this->_validators[Zend_Validate_File_Upload::class]; $validator->setFiles($temp) ->isValid($files, null); $this->_messages += $validator->getMessages(); @@ -232,8 +224,6 @@ public function receive($files = null) */ public function isSent($files = null) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -306,117 +296,6 @@ public function isUploaded($files = null) return true; } - /** - * Returns the actual progress of file up-/downloads. - * - * @param string $id The upload to get the progress for - * - * @return null|array - */ - public static function getProgress($id = null) - { - $call = null; - if (!function_exists('apc_fetch') and !function_exists('uploadprogress_get_info')) { - require_once 'Zend/File/Transfer/Exception.php'; - - throw new Zend_File_Transfer_Exception('Neither APC nor uploadprogress extension installed'); - } - - $session = 'Zend_File_Transfer_Adapter_Http_ProgressBar'; - $status = [ - 'total' => 0, - 'current' => 0, - 'rate' => 0, - 'message' => '', - 'done' => false, - ]; - - if (is_array($id)) { - if (isset($id['progress'])) { - $adapter = $id['progress']; - } - - if (isset($id['session'])) { - $session = $id['session']; - } - - if (isset($id['id'])) { - $id = $id['id']; - } else { - unset($id); - } - } - - if (!empty($id) && (($id instanceof Zend_ProgressBar_Adapter) || ($id instanceof Zend_ProgressBar))) { - $adapter = $id; - unset($id); - } - - if (empty($id)) { - if (!isset($_GET['progress_key'])) { - $status['message'] = 'No upload in progress'; - $status['done'] = true; - } else { - $id = $_GET['progress_key']; - } - } - - if (!empty($id)) { - if (self::isApcAvailable()) { - $call = call_user_func(self::$_callbackApc, ini_get('apc.rfc1867_prefix') . $id); - if (is_array($call)) { - $status = $call + $status; - } - } elseif (self::isUploadProgressAvailable()) { - $call = call_user_func(self::$_callbackUploadProgress, $id); - if (is_array($call)) { - $status = $call + $status; - $status['total'] = $status['bytes_total']; - $status['current'] = $status['bytes_uploaded']; - $status['rate'] = $status['speed_average']; - if ($status['total'] == $status['current']) { - $status['done'] = true; - } - } - } - - if (!is_array($call)) { - $status['done'] = true; - $status['message'] = 'Failure while retrieving the upload progress'; - } elseif (!empty($status['cancel_upload'])) { - $status['done'] = true; - $status['message'] = 'The upload has been canceled'; - } else { - $status['message'] = self::_toByteString($status['current']) . ' - ' . self::_toByteString($status['total']); - } - - $status['id'] = $id; - } - - if (isset($adapter, $status['id'])) { - if ($adapter instanceof Zend_ProgressBar_Adapter) { - require_once 'Zend/ProgressBar.php'; - $adapter = new Zend_ProgressBar($adapter, 0, $status['total'], $session); - } - - if (!($adapter instanceof Zend_ProgressBar)) { - require_once 'Zend/File/Transfer/Exception.php'; - - throw new Zend_File_Transfer_Exception('Unknown Adapter given'); - } - - if ($status['done']) { - $adapter->finish(); - } else { - $adapter->update($status['current'], $status['message']); - } - - $status['progress'] = $adapter; - } - - return $status; - } - /** * Checks the APC extension for progress information. * diff --git a/library/Zend/File/Transfer/Exception.php b/library/Zend/File/Transfer/Exception.php index 8aa0d6408..6d4010cb2 100644 --- a/library/Zend/File/Transfer/Exception.php +++ b/library/Zend/File/Transfer/Exception.php @@ -1,4 +1,5 @@ implementsInterface(\Zend_Filter_Interface::class)) { + if ($class->implementsInterface(Zend_Filter_Interface::class)) { if ($class->hasMethod('__construct')) { $object = $class->newInstanceArgs($args); } else { @@ -228,7 +223,6 @@ public static function filterStatic($value, $classBaseName, array $args = [], $n return $object->filter($value); } } - require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception("Filter class not found from basename '$classBaseName'"); } diff --git a/library/Zend/Filter/Alnum.php b/library/Zend/Filter/Alnum.php index 754291c42..1eedbd6d9 100644 --- a/library/Zend/Filter/Alnum.php +++ b/library/Zend/Filter/Alnum.php @@ -1,4 +1,5 @@ self::ALL)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Unknown type'); } @@ -184,16 +178,11 @@ public function setLocale($locale = null) } elseif ($locale instanceof Zend_Locale) { $locale = [$locale->toString()]; } elseif (!is_array($locale)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Locale has to be string, array or an instance of Zend_Locale'); } - require_once 'Zend/Locale.php'; foreach ($locale as $single) { if (!Zend_Locale::isLocale($single)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Unknown locale '$single'"); } } @@ -245,7 +234,6 @@ public function filter($value) if ($type >= self::YES) { $type -= self::YES; if (is_string($value)) { - require_once 'Zend/Locale.php'; $locales = $this->getLocale(); foreach ($locales as $locale) { if ($this->_getLocalizedQuestion($value, false, $locale) === false) { diff --git a/library/Zend/Filter/Callback.php b/library/Zend/Filter/Callback.php index a309db3d9..ea7c6e57c 100644 --- a/library/Zend/Filter/Callback.php +++ b/library/Zend/Filter/Callback.php @@ -1,4 +1,5 @@ toArray(); - } - if (is_string($options)) { - $this->setAdapter($options); - } elseif ($options instanceof Zend_Filter_Compress_CompressInterface) { - $this->setAdapter($options); - } elseif (is_array($options)) { - $this->setOptions($options); - } - } - - /** - * Set filter setate. - * - * @return Zend_Filter_Compress - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - if ($key == 'options') { - $key = 'adapterOptions'; - } - $method = 'set' . ucfirst($key); - if (method_exists($this, $method)) { - $this->$method($value); - } - } - - return $this; - } - - /** - * Returns the current adapter, instantiating it if necessary. - * - * @return string - */ - public function getAdapter() - { - if ($this->_adapter instanceof Zend_Filter_Compress_CompressInterface) { - return $this->_adapter; - } - - $adapter = $this->_adapter; - $options = $this->getAdapterOptions(); - if (!class_exists($adapter)) { - require_once 'Zend/Loader.php'; - if (Zend_Loader::isReadable('Zend/Filter/Compress/' . ucfirst($adapter) . '.php')) { - $adapter = 'Zend_Filter_Compress_' . ucfirst($adapter); - } - Zend_Loader::loadClass($adapter); - } - - $this->_adapter = new $adapter($options); - if (!$this->_adapter instanceof Zend_Filter_Compress_CompressInterface) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("Compression adapter '" . $adapter . "' does not implement Zend_Filter_Compress_CompressInterface"); - } - - return $this->_adapter; - } - - /** - * Retrieve adapter name. - * - * @return string - */ - public function getAdapterName() - { - return $this->getAdapter()->toString(); - } - - /** - * Sets compression adapter. - * - * @param string|Zend_Filter_Compress_CompressInterface $adapter Adapter to use - * - * @return Zend_Filter_Compress - */ - public function setAdapter($adapter) - { - if ($adapter instanceof Zend_Filter_Compress_CompressInterface) { - $this->_adapter = $adapter; - - return $this; - } - if (!is_string($adapter)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Invalid adapter provided; must be string or instance of Zend_Filter_Compress_CompressInterface'); - } - $this->_adapter = $adapter; - - return $this; - } - - /** - * Retrieve adapter options. - * - * @return array - */ - public function getAdapterOptions() - { - return $this->_adapterOptions; - } - - /** - * Set adapter options. - */ - public function setAdapterOptions(array $options) - { - $this->_adapterOptions = $options; - - return $this; - } - - /** - * Calls adapter methods. - * - * @param string $method Method to call - * @param array|string $options Options for this method - */ - public function __call($method, $options) - { - $adapter = $this->getAdapter(); - if (!method_exists($adapter, $method)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("Unknown method '{$method}'"); - } - - return call_user_func_array([$adapter, $method], $options); - } - - /** - * Defined by Zend_Filter_Interface. - * - * Compresses the content $value with the defined settings - * - * @param string $value Content to compress - * - * @return string The compressed content - */ - public function filter($value) - { - return $this->getAdapter()->compress($value); - } -} diff --git a/library/Zend/Filter/Compress/Bz2.php b/library/Zend/Filter/Compress/Bz2.php deleted file mode 100644 index d159137bc..000000000 --- a/library/Zend/Filter/Compress/Bz2.php +++ /dev/null @@ -1,196 +0,0 @@ - Blocksize to use from 0-9 - * 'archive' => Archive to use - * ). - * - * @var array - */ - protected $_options = [ - 'blocksize' => 4, - 'archive' => null, - ]; - - /** - * Class constructor. - * - * @param array|Zend_Config $options (Optional) Options to set - */ - public function __construct($options = null) - { - if (!extension_loaded('bz2')) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('This filter needs the bz2 extension'); - } - parent::__construct($options); - } - - /** - * Returns the set blocksize. - * - * @return int - */ - public function getBlocksize() - { - return $this->_options['blocksize']; - } - - /** - * Sets a new blocksize. - * - * @param mixed $blocksize - * - * @return Zend_Filter_Compress_Bz2 - */ - public function setBlocksize($blocksize) - { - if (($blocksize < 0) || ($blocksize > 9)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Blocksize must be between 0 and 9'); - } - - $this->_options['blocksize'] = (int) $blocksize; - - return $this; - } - - /** - * Returns the set archive. - * - * @return string - */ - public function getArchive() - { - return $this->_options['archive']; - } - - /** - * Sets the archive to use for de-/compression. - * - * @param string $archive Archive to use - * - * @return Zend_Filter_Compress_Bz2 - */ - public function setArchive($archive) - { - $this->_options['archive'] = (string) $archive; - - return $this; - } - - /** - * Compresses the given content. - * - * @param string $content - * - * @return string - */ - public function compress($content) - { - $archive = $this->getArchive(); - if (!empty($archive)) { - $file = bzopen($archive, 'w'); - if (!$file) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("Error opening the archive '" . $archive . "'"); - } - - bzwrite($file, $content); - bzclose($file); - $compressed = true; - } else { - $compressed = bzcompress($content, $this->getBlocksize()); - } - - if (is_int($compressed)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error during compression'); - } - - return $compressed; - } - - /** - * Decompresses the given content. - * - * @param string $content - * - * @return string - */ - public function decompress($content) - { - $archive = $this->getArchive(); - if (@file_exists($content)) { - $archive = $content; - } - - if (@file_exists($archive)) { - $file = bzopen($archive, 'r'); - if (!$file) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("Error opening the archive '" . $content . "'"); - } - - $compressed = bzread($file); - bzclose($file); - } else { - $compressed = bzdecompress($content); - } - - if (is_int($compressed)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error during decompression'); - } - - return $compressed; - } - - /** - * Returns the adapter name. - * - * @return string - */ - public function toString() - { - return 'Bz2'; - } -} diff --git a/library/Zend/Filter/Compress/CompressAbstract.php b/library/Zend/Filter/Compress/CompressAbstract.php deleted file mode 100644 index 9f3dc3425..000000000 --- a/library/Zend/Filter/Compress/CompressAbstract.php +++ /dev/null @@ -1,85 +0,0 @@ -toArray(); - } - - if (is_array($options)) { - $this->setOptions($options); - } - } - - /** - * Returns one or all set options. - * - * @param string $option (Optional) Option to return - * - * @return mixed - */ - public function getOptions($option = null) - { - if ($option === null) { - return $this->_options; - } - - if (!array_key_exists($option, $this->_options)) { - return null; - } - - return $this->_options[$option]; - } - - /** - * Sets all or one option. - * - * @return Zend_Filter_Compress_Bz2 - */ - public function setOptions(array $options) - { - foreach ($options as $key => $option) { - $method = 'set' . $key; - if (method_exists($this, $method)) { - $this->$method($option); - } - } - - return $this; - } -} diff --git a/library/Zend/Filter/Compress/CompressInterface.php b/library/Zend/Filter/Compress/CompressInterface.php deleted file mode 100644 index 55507134f..000000000 --- a/library/Zend/Filter/Compress/CompressInterface.php +++ /dev/null @@ -1,51 +0,0 @@ - Compression level 0-9 - * 'mode' => Compression mode, can be 'compress', 'deflate' - * 'archive' => Archive to use - * ). - * - * @var array - */ - protected $_options = [ - 'level' => 9, - 'mode' => 'compress', - 'archive' => null, - ]; - - /** - * Class constructor. - * - * @param null|array|Zend_Config $options (Optional) Options to set - */ - public function __construct($options = null) - { - if (!extension_loaded('zlib')) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('This filter needs the zlib extension'); - } - parent::__construct($options); - } - - /** - * Returns the set compression level. - * - * @return int - */ - public function getLevel() - { - return $this->_options['level']; - } - - /** - * Sets a new compression level. - * - * @param int $level - * - * @return Zend_Filter_Compress_Gz - */ - public function setLevel($level) - { - if (($level < 0) || ($level > 9)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Level must be between 0 and 9'); - } - - $this->_options['level'] = (int) $level; - - return $this; - } - - /** - * Returns the set compression mode. - * - * @return string - */ - public function getMode() - { - return $this->_options['mode']; - } - - /** - * Sets a new compression mode. - * - * @param string $mode Supported are 'compress', 'deflate' and 'file' - */ - public function setMode($mode) - { - if (($mode != 'compress') && ($mode != 'deflate')) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Given compression mode not supported'); - } - - $this->_options['mode'] = $mode; - - return $this; - } - - /** - * Returns the set archive. - * - * @return string - */ - public function getArchive() - { - return $this->_options['archive']; - } - - /** - * Sets the archive to use for de-/compression. - * - * @param string $archive Archive to use - * - * @return Zend_Filter_Compress_Gz - */ - public function setArchive($archive) - { - $this->_options['archive'] = (string) $archive; - - return $this; - } - - /** - * Compresses the given content. - * - * @param string $content - * - * @return string - */ - public function compress($content) - { - $archive = $this->getArchive(); - if (!empty($archive)) { - $file = gzopen($archive, 'w' . $this->getLevel()); - if (!$file) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("Error opening the archive '" . $this->_options['archive'] . "'"); - } - - gzwrite($file, $content); - gzclose($file); - $compressed = true; - } elseif ($this->_options['mode'] == 'deflate') { - $compressed = gzdeflate($content, $this->getLevel()); - } else { - $compressed = gzcompress($content, $this->getLevel()); - } - - if (!$compressed) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error during compression'); - } - - return $compressed; - } - - /** - * Decompresses the given content. - * - * @param string $content - * - * @return string - */ - public function decompress($content) - { - $archive = $this->getArchive(); - $mode = $this->getMode(); - if (@file_exists($content)) { - $archive = $content; - } - - if (@file_exists($archive)) { - $handler = fopen($archive, 'rb'); - if (!$handler) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("Error opening the archive '" . $archive . "'"); - } - - fseek($handler, -4, SEEK_END); - $packet = fread($handler, 4); - $bytes = unpack('V', $packet); - $size = end($bytes); - fclose($handler); - - $file = gzopen($archive, 'r'); - $compressed = gzread($file, $size); - gzclose($file); - } elseif ($mode == 'deflate') { - $compressed = gzinflate($content); - } else { - $compressed = gzuncompress($content); - } - - if (!$compressed) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error during compression'); - } - - return $compressed; - } - - /** - * Returns the adapter name. - * - * @return string - */ - public function toString() - { - return 'Gz'; - } -} diff --git a/library/Zend/Filter/Compress/Lzf.php b/library/Zend/Filter/Compress/Lzf.php deleted file mode 100644 index c3ee84662..000000000 --- a/library/Zend/Filter/Compress/Lzf.php +++ /dev/null @@ -1,92 +0,0 @@ - Callback for compression - * 'archive' => Archive to use - * 'password' => Password to use - * 'target' => Target to write the files to - * ). - * - * @var array - */ - protected $_options = [ - 'callback' => null, - 'archive' => null, - 'password' => null, - 'target' => '.', - ]; - - /** - * Class constructor. - * - * @param array $options (Optional) Options to set - */ - public function __construct($options = null) - { - if (!extension_loaded('rar')) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('This filter needs the rar extension'); - } - parent::__construct($options); - } - - /** - * Returns the set callback for compression. - * - * @return string - */ - public function getCallback() - { - return $this->_options['callback']; - } - - /** - * Sets the callback to use. - * - * @param string $callback - * - * @return Zend_Filter_Compress_Rar - */ - public function setCallback($callback) - { - if (!is_callable($callback)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Callback can not be accessed'); - } - - $this->_options['callback'] = $callback; - - return $this; - } - - /** - * Returns the set archive. - * - * @return string - */ - public function getArchive() - { - return $this->_options['archive']; - } - - /** - * Sets the archive to use for de-/compression. - * - * @param string $archive Archive to use - * - * @return Zend_Filter_Compress_Rar - */ - public function setArchive($archive) - { - $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $archive); - $this->_options['archive'] = (string) $archive; - - return $this; - } - - /** - * Returns the set password. - * - * @return string - */ - public function getPassword() - { - return $this->_options['password']; - } - - /** - * Sets the password to use. - * - * @param string $password - * - * @return Zend_Filter_Compress_Rar - */ - public function setPassword($password) - { - $this->_options['password'] = (string) $password; - - return $this; - } - - /** - * Returns the set targetpath. - * - * @return string - */ - public function getTarget() - { - return $this->_options['target']; - } - - /** - * Sets the targetpath to use. - * - * @param string $target - * - * @return Zend_Filter_Compress_Rar - */ - public function setTarget($target) - { - if (!file_exists(dirname($target))) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("The directory '$target' does not exist"); - } - - $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $target); - $this->_options['target'] = (string) $target; - - return $this; - } - - /** - * Compresses the given content. - * - * @param array|string $content - * - * @return string - */ - public function compress($content) - { - $callback = $this->getCallback(); - if ($callback === null) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('No compression callback available'); - } - - $options = $this->getOptions(); - unset($options['callback']); - - $result = call_user_func($callback, $options, $content); - if ($result !== true) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error compressing the RAR Archive'); - } - - return $this->getArchive(); - } - - /** - * Decompresses the given content. - * - * @param string $content - * - * @return bool - */ - public function decompress($content) - { - $archive = $this->getArchive(); - if (file_exists($content)) { - $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); - } elseif (empty($archive) || !file_exists($archive)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('RAR Archive not found'); - } - - $password = $this->getPassword(); - if ($password !== null) { - $archive = rar_open($archive, $password); - } else { - $archive = rar_open($archive); - } - - if (!$archive) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error opening the RAR Archive'); - } - - $target = $this->getTarget(); - if (!is_dir($target)) { - $target = dirname($target); - } - - $filelist = rar_list($archive); - if (!$filelist) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error reading the RAR Archive'); - } - - foreach ($filelist as $file) { - $file->extract($target); - } - - rar_close($archive); - - return true; - } - - /** - * Returns the adapter name. - * - * @return string - */ - public function toString() - { - return 'Rar'; - } -} diff --git a/library/Zend/Filter/Compress/Tar.php b/library/Zend/Filter/Compress/Tar.php deleted file mode 100644 index 7add64d9f..000000000 --- a/library/Zend/Filter/Compress/Tar.php +++ /dev/null @@ -1,256 +0,0 @@ - Archive to use - * 'target' => Target to write the files to - * ). - * - * @var array - */ - protected $_options = [ - 'archive' => null, - 'target' => '.', - 'mode' => null, - ]; - - /** - * Class constructor. - * - * @param array $options (Optional) Options to set - */ - public function __construct($options = null) - { - if (!class_exists('Archive_Tar')) { - require_once 'Zend/Loader.php'; - - try { - Zend_Loader::loadClass('Archive_Tar'); - } catch (Zend_Exception $e) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('This filter needs PEARs Archive_Tar', 0, $e); - } - } - - parent::__construct($options); - } - - /** - * Returns the set archive. - * - * @return string - */ - public function getArchive() - { - return $this->_options['archive']; - } - - /** - * Sets the archive to use for de-/compression. - * - * @param string $archive Archive to use - * - * @return Zend_Filter_Compress_Tar - */ - public function setArchive($archive) - { - $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $archive); - $this->_options['archive'] = (string) $archive; - - return $this; - } - - /** - * Returns the set targetpath. - * - * @return string - */ - public function getTarget() - { - return $this->_options['target']; - } - - /** - * Sets the targetpath to use. - * - * @param string $target - * - * @return Zend_Filter_Compress_Tar - */ - public function setTarget($target) - { - if (!file_exists(dirname($target))) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("The directory '$target' does not exist"); - } - - $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $target); - $this->_options['target'] = (string) $target; - - return $this; - } - - /** - * Returns the set compression mode. - */ - public function getMode() - { - return $this->_options['mode']; - } - - /** - * Compression mode to use - * Eighter Gz or Bz2. - * - * @param string $mode - */ - public function setMode($mode) - { - $mode = ucfirst(strtolower($mode)); - if (($mode != 'Bz2') && ($mode != 'Gz')) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("The mode '$mode' is unknown"); - } - - if (($mode == 'Bz2') && (!extension_loaded('bz2'))) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('This mode needs the bz2 extension'); - } - - if (($mode == 'Gz') && (!extension_loaded('zlib'))) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('This mode needs the zlib extension'); - } - } - - /** - * Compresses the given content. - * - * @param string $content - * - * @return string - */ - public function compress($content) - { - $archive = new Archive_Tar($this->getArchive(), $this->getMode()); - if (!file_exists($content)) { - $file = $this->getTarget(); - if (is_dir($file)) { - $file .= DIRECTORY_SEPARATOR . 'tar.tmp'; - } - - $result = file_put_contents($file, $content); - if ($result === false) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error creating the temporary file'); - } - - $content = $file; - } - - if (is_dir($content)) { - // collect all file infos - foreach (new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($content, RecursiveDirectoryIterator::KEY_AS_PATHNAME), - RecursiveIteratorIterator::SELF_FIRST - ) as $directory => $info - ) { - if ($info->isFile()) { - $file[] = $directory; - } - } - - $content = $file; - } - - $result = $archive->create($content); - if ($result === false) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error creating the Tar archive'); - } - - return $this->getArchive(); - } - - /** - * Decompresses the given content. - * - * @param string $content - * - * @return bool - */ - public function decompress($content) - { - $archive = $this->getArchive(); - if (file_exists($content)) { - $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); - } elseif (empty($archive) || !file_exists($archive)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Tar Archive not found'); - } - - $archive = new Archive_Tar($archive, $this->getMode()); - $target = $this->getTarget(); - if (!is_dir($target)) { - $target = dirname($target); - } - - $result = $archive->extract($target); - if ($result === false) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Error while extracting the Tar archive'); - } - - return true; - } - - /** - * Returns the adapter name. - * - * @return string - */ - public function toString() - { - return 'Tar'; - } -} diff --git a/library/Zend/Filter/Compress/Zip.php b/library/Zend/Filter/Compress/Zip.php deleted file mode 100644 index 07824145d..000000000 --- a/library/Zend/Filter/Compress/Zip.php +++ /dev/null @@ -1,368 +0,0 @@ - Archive to use - * 'password' => Password to use - * 'target' => Target to write the files to - * ). - * - * @var array - */ - protected $_options = [ - 'archive' => null, - 'target' => null, - ]; - - /** - * Class constructor. - * - * @param array|string $options (Optional) Options to set - */ - public function __construct($options = null) - { - if (!extension_loaded('zip')) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('This filter needs the zip extension'); - } - parent::__construct($options); - } - - /** - * Returns the set archive. - * - * @return string - */ - public function getArchive() - { - return $this->_options['archive']; - } - - /** - * Sets the archive to use for de-/compression. - * - * @param string $archive Archive to use - * - * @return Zend_Filter_Compress_Rar - */ - public function setArchive($archive) - { - $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $archive); - $this->_options['archive'] = (string) $archive; - - return $this; - } - - /** - * Returns the set targetpath. - * - * @return string - */ - public function getTarget() - { - return $this->_options['target']; - } - - /** - * Sets the target to use. - * - * @param string $target - * - * @return Zend_Filter_Compress_Rar - */ - public function setTarget($target) - { - if (!file_exists(dirname($target))) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception("The directory '$target' does not exist"); - } - - $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $target); - $this->_options['target'] = (string) $target; - - return $this; - } - - /** - * Compresses the given content. - * - * @param string $content - * - * @return string Compressed archive - */ - public function compress($content) - { - $zip = new ZipArchive(); - $res = $zip->open($this->getArchive(), ZipArchive::CREATE | ZipArchive::OVERWRITE); - - if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception($this->_errorString($res)); - } - - if (file_exists($content)) { - $content = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); - $basename = substr($content, strrpos($content, DIRECTORY_SEPARATOR) + 1); - if (is_dir($content)) { - $index = strrpos($content, DIRECTORY_SEPARATOR) + 1; - $content .= DIRECTORY_SEPARATOR; - $stack = [$content]; - while (!empty($stack)) { - $current = array_pop($stack); - $files = []; - - $dir = dir($current); - while (false !== ($node = $dir->read())) { - if (($node == '.') || ($node == '..')) { - continue; - } - - if (is_dir($current . $node)) { - array_push($stack, $current . $node . DIRECTORY_SEPARATOR); - } - - if (is_file($current . $node)) { - $files[] = $node; - } - } - - $local = substr($current, $index); - $zip->addEmptyDir(substr($local, 0, -1)); - - foreach ($files as $file) { - $zip->addFile($current . $file, $local . $file); - if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception($this->_errorString($res)); - } - } - } - } else { - $res = $zip->addFile($content, $basename); - if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception($this->_errorString($res)); - } - } - } else { - $file = $this->getTarget(); - if (!is_dir($file)) { - $file = basename($file); - } else { - $file = 'zip.tmp'; - } - - $res = $zip->addFromString($file, $content); - if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception($this->_errorString($res)); - } - } - - $zip->close(); - - return $this->_options['archive']; - } - - /** - * Decompresses the given content. - * - * @param string $content - * - * @return string - */ - public function decompress($content) - { - $archive = $this->getArchive(); - if (file_exists($content)) { - $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); - } elseif (empty($archive) || !file_exists($archive)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('ZIP Archive not found'); - } - - $zip = new ZipArchive(); - $res = $zip->open($archive); - - $target = $this->getTarget(); - - if (!empty($target) && !is_dir($target)) { - $target = dirname($target); - } - - if (!empty($target)) { - $target = rtrim($target, '/\\') . DIRECTORY_SEPARATOR; - } - - if (empty($target) || !is_dir($target)) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('No target for ZIP decompression set'); - } - - if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception($this->_errorString($res)); - } - - if (version_compare(PHP_VERSION, '5.2.8', '<')) { - for ($i = 0; $i < $zip->numFiles; ++$i) { - $statIndex = $zip->statIndex($i); - $currName = $statIndex['name']; - if (($currName[0] == '/') - || (substr($currName, 0, 2) == '..') - || (substr($currName, 0, 4) == './..') - ) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception('Upward directory traversal was detected inside ' . $archive - . ' please use PHP 5.2.8 or greater to take advantage of path resolution features of ' - . 'the zip extension in this decompress() method.' - ); - } - } - } - - $res = @$zip->extractTo($target); - if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - - throw new Zend_Filter_Exception($this->_errorString($res)); - } - - $zip->close(); - - return $target; - } - - /** - * Returns the proper string based on the given error constant. - * - * @param string $error - */ - protected function _errorString($error) - { - switch ($error) { - case ZipArchive::ER_MULTIDISK: - return 'Multidisk ZIP Archives not supported'; - - case ZipArchive::ER_RENAME: - return 'Failed to rename the temporary file for ZIP'; - - case ZipArchive::ER_CLOSE: - return 'Failed to close the ZIP Archive'; - - case ZipArchive::ER_SEEK: - return 'Failure while seeking the ZIP Archive'; - - case ZipArchive::ER_READ: - return 'Failure while reading the ZIP Archive'; - - case ZipArchive::ER_WRITE: - return 'Failure while writing the ZIP Archive'; - - case ZipArchive::ER_CRC: - return 'CRC failure within the ZIP Archive'; - - case ZipArchive::ER_ZIPCLOSED: - return 'ZIP Archive already closed'; - - case ZipArchive::ER_NOENT: - return 'No such file within the ZIP Archive'; - - case ZipArchive::ER_EXISTS: - return 'ZIP Archive already exists'; - - case ZipArchive::ER_OPEN: - return 'Can not open ZIP Archive'; - - case ZipArchive::ER_TMPOPEN: - return 'Failure creating temporary ZIP Archive'; - - case ZipArchive::ER_ZLIB: - return 'ZLib Problem'; - - case ZipArchive::ER_MEMORY: - return 'Memory allocation problem while working on a ZIP Archive'; - - case ZipArchive::ER_CHANGED: - return 'ZIP Entry has been changed'; - - case ZipArchive::ER_COMPNOTSUPP: - return 'Compression method not supported within ZLib'; - - case ZipArchive::ER_EOF: - return 'Premature EOF within ZIP Archive'; - - case ZipArchive::ER_INVAL: - return 'Invalid argument for ZLIB'; - - case ZipArchive::ER_NOZIP: - return 'Given file is no zip archive'; - - case ZipArchive::ER_INTERNAL: - return 'Internal error while working on a ZIP Archive'; - - case ZipArchive::ER_INCONS: - return 'Inconsistent ZIP archive'; - - case ZipArchive::ER_REMOVE: - return 'Can not remove ZIP Archive'; - - case ZipArchive::ER_DELETED: - return 'ZIP Entry has been deleted'; - - default: - return 'Unknown error within ZIP Archive'; - } - } - - /** - * Returns the adapter name. - * - * @return string - */ - public function toString() - { - return 'Zip'; - } -} diff --git a/library/Zend/Filter/Decompress.php b/library/Zend/Filter/Decompress.php deleted file mode 100644 index f14e14882..000000000 --- a/library/Zend/Filter/Decompress.php +++ /dev/null @@ -1,46 +0,0 @@ -getAdapter()->decompress($value); - } -} diff --git a/library/Zend/Filter/Digits.php b/library/Zend/Filter/Digits.php index db8b5dbf4..55aebabfe 100644 --- a/library/Zend/Filter/Digits.php +++ b/library/Zend/Filter/Digits.php @@ -18,11 +18,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Dir.php b/library/Zend/Filter/Dir.php index eaf6cfd5d..7f8c508f3 100644 --- a/library/Zend/Filter/Dir.php +++ b/library/Zend/Filter/Dir.php @@ -18,11 +18,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Exception.php b/library/Zend/Filter/Exception.php index 2b7c357b1..78e390816 100644 --- a/library/Zend/Filter/Exception.php +++ b/library/Zend/Filter/Exception.php @@ -21,8 +21,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/File/LowerCase.php b/library/Zend/Filter/File/LowerCase.php index 45a30ec4d..f61d61390 100644 --- a/library/Zend/Filter/File/LowerCase.php +++ b/library/Zend/Filter/File/LowerCase.php @@ -1,4 +1,5 @@ $options]; } elseif (!is_array($options)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Invalid options argument provided to filter'); } @@ -118,8 +112,6 @@ public function addFile($options) if (is_string($options)) { $options = ['target' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Invalid options to rename filter provided'); } @@ -158,8 +150,6 @@ public function getNewName($value, $source = false) } if (file_exists($file['target'])) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception(sprintf("File '%s' could not be renamed. It already exists.", $value)); } @@ -193,8 +183,6 @@ public function filter($value) return $file['target']; } - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception(sprintf("File '%s' could not be renamed. An error occured while processing the file.", $value)); } diff --git a/library/Zend/Filter/File/UpperCase.php b/library/Zend/Filter/File/UpperCase.php index b64852fad..f3cb6c550 100644 --- a/library/Zend/Filter/File/UpperCase.php +++ b/library/Zend/Filter/File/UpperCase.php @@ -1,4 +1,5 @@ getQuoteStyle(), $this->getEncoding(), $this->getDoubleQuote()); if (strlen((string) $value) && !strlen($filtered)) { if (!function_exists('iconv')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Encoding mismatch has resulted in htmlentities errors'); } $enc = $this->getEncoding(); $value = iconv('', $enc . '//IGNORE', (string) $value); $filtered = htmlentities($value, $this->getQuoteStyle(), $enc, $this->getDoubleQuote()); if (!strlen($filtered)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Encoding mismatch has resulted in htmlentities errors'); } } diff --git a/library/Zend/Filter/Inflector.php b/library/Zend/Filter/Inflector.php index cd409d51d..c7d701c81 100644 --- a/library/Zend/Filter/Inflector.php +++ b/library/Zend/Filter/Inflector.php @@ -1,4 +1,5 @@ _target); if ($this->_throwTargetExceptionsOn && (preg_match('#(?=' . $pregQuotedTargetReplacementIdentifier . '[A-Za-z]{1})#', $inflectedTarget) == true)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('A replacement identifier ' . $this->_targetReplacementIdentifier . ' was found inside the inflected target, perhaps a rule was not satisfied with a target source? Unsatisfied inflected target: ' . $inflectedTarget); } @@ -541,8 +534,6 @@ protected function _getRule($rule) $className = $this->getPluginLoader()->load($rule); $ruleObject = new $className(); if (!$ruleObject instanceof Zend_Filter_Interface) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('No class named ' . $rule . ' implementing Zend_Filter_Interface could be found'); } diff --git a/library/Zend/Filter/Input.php b/library/Zend/Filter/Input.php index faa70a2e5..bcac46032 100644 --- a/library/Zend/Filter/Input.php +++ b/library/Zend/Filter/Input.php @@ -1,4 +1,5 @@ _loaders[$type] = new Zend_Loader_PluginLoader( [$prefixSegment => $pathSegment] ); @@ -489,13 +456,9 @@ public function process() { $this->_process(); if ($this->hasInvalid()) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Input has invalid fields'); } if ($this->hasMissing()) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Input has missing fields'); } @@ -532,8 +495,6 @@ public function setDefaultEscapeFilter($escapeFilter) $escapeFilter = $this->_getFilter($escapeFilter); } if (!$escapeFilter instanceof Zend_Filter_Interface) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Escape filter specified does not implement Zend_Filter_Interface'); } $this->_defaultEscapeFilter = $escapeFilter; @@ -591,8 +552,6 @@ public function setOptions(array $options) break; default: - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Unknown option '$option'"); break; @@ -602,79 +561,6 @@ public function setOptions(array $options) return $this; } - /** - * Set translation object. - * - * @param null|Zend_Translate|Zend_Translate_Adapter $translator - * - * @return Zend_Filter_Input - */ - public function setTranslator($translator = null) - { - if ((null === $translator) || ($translator instanceof Zend_Translate_Adapter)) { - $this->_translator = $translator; - } elseif ($translator instanceof Zend_Translate) { - $this->_translator = $translator->getAdapter(); - } else { - require_once 'Zend/Validate/Exception.php'; - - throw new Zend_Validate_Exception('Invalid translator specified'); - } - - return $this; - } - - /** - * Return translation object. - * - * @return null|Zend_Translate_Adapter - */ - public function getTranslator() - { - if ($this->translatorIsDisabled()) { - return null; - } - - if ($this->_translator === null) { - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered(\Zend_Translate::class)) { - $translator = Zend_Registry::get(\Zend_Translate::class); - if ($translator instanceof Zend_Translate_Adapter) { - return $translator; - } - if ($translator instanceof Zend_Translate) { - return $translator->getAdapter(); - } - } - } - - return $this->_translator; - } - - /** - * Indicate whether or not translation should be disabled. - * - * @param bool $flag - * - * @return Zend_Filter_Input - */ - public function setDisableTranslator($flag) - { - $this->_translatorDisabled = (bool) $flag; - - return $this; - } - - /** - * Is translation disabled? - * - * @return bool - */ - public function translatorIsDisabled() - { - return $this->_translatorDisabled; - } - // Protected methods protected function _filter() @@ -769,14 +655,6 @@ protected function _getMissingMessage($rule, $field) { $message = $this->_defaults[self::MISSING_MESSAGE]; - if (null !== ($translator = $this->getTranslator())) { - if ($translator->isTranslated(self::MISSING_MESSAGE)) { - $message = $translator->translate(self::MISSING_MESSAGE); - } else { - $message = $translator->translate($message); - } - } - $message = str_replace('%rule%', $rule, $message); $message = str_replace('%field%', $field, $message); @@ -793,14 +671,6 @@ protected function _getNotEmptyMessage($rule, $field) { $message = $this->_defaults[self::NOT_EMPTY_MESSAGE]; - if (null !== ($translator = $this->getTranslator())) { - if ($translator->isTranslated(self::NOT_EMPTY_MESSAGE)) { - $message = $translator->translate(self::NOT_EMPTY_MESSAGE); - } else { - $message = $translator->translate($message); - } - } - $message = str_replace('%rule%', $rule, $message); $message = str_replace('%field%', $field, $message); @@ -1209,8 +1079,6 @@ protected function _getFilterOrValidator($type, $classBaseName) $class = new ReflectionClass($className); if (!$class->implementsInterface($interfaceName)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Class '$className' based on basename '$classBaseName' must implement the '$interfaceName' interface"); } diff --git a/library/Zend/Filter/Int.php b/library/Zend/Filter/Int.php index c05667a93..faa2e259d 100644 --- a/library/Zend/Filter/Int.php +++ b/library/Zend/Filter/Int.php @@ -18,11 +18,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Null.php b/library/Zend/Filter/Null.php index baeba00d3..51009136f 100644 --- a/library/Zend/Filter/Null.php +++ b/library/Zend/Filter/Null.php @@ -1,4 +1,5 @@ self::ALL)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Unknown type'); } diff --git a/library/Zend/Filter/PregReplace.php b/library/Zend/Filter/PregReplace.php index 8d00be094..e8164709d 100644 --- a/library/Zend/Filter/PregReplace.php +++ b/library/Zend/Filter/PregReplace.php @@ -1,4 +1,5 @@ _matchPattern == null) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception(get_class($this) . ' does not have a valid MatchPattern set.'); } diff --git a/library/Zend/Filter/RealPath.php b/library/Zend/Filter/RealPath.php index 16183cd36..2ba602599 100644 --- a/library/Zend/Filter/RealPath.php +++ b/library/Zend/Filter/RealPath.php @@ -1,4 +1,5 @@ _separator = $separator; diff --git a/library/Zend/Filter/Word/SeparatorToCamelCase.php b/library/Zend/Filter/Word/SeparatorToCamelCase.php index f4de4ffc7..54bb25080 100644 --- a/library/Zend/Filter/Word/SeparatorToCamelCase.php +++ b/library/Zend/Filter/Word/SeparatorToCamelCase.php @@ -1,4 +1,5 @@ _matchPattern, $this->_replacement, $value); diff --git a/library/Zend/Filter/Word/SeparatorToDash.php b/library/Zend/Filter/Word/SeparatorToDash.php index 0eb381dfd..71cd1cbd4 100644 --- a/library/Zend/Filter/Word/SeparatorToDash.php +++ b/library/Zend/Filter/Word/SeparatorToDash.php @@ -1,4 +1,5 @@ _searchSeparator == null) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('You must provide a search separator for this filter to work.'); } diff --git a/library/Zend/Filter/Word/UnderscoreToCamelCase.php b/library/Zend/Filter/Word/UnderscoreToCamelCase.php index edb884346..24ec12164 100644 --- a/library/Zend/Filter/Word/UnderscoreToCamelCase.php +++ b/library/Zend/Filter/Word/UnderscoreToCamelCase.php @@ -1,4 +1,5 @@ _loaders[$type] = new Zend_Loader_PluginLoader( ['Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/'] ); @@ -540,8 +516,6 @@ public function addPrefixPath($prefix, $path, $type = null) return $this; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -831,8 +805,6 @@ public function setMethod($method) { $method = strtolower($method); if (!in_array($method, $this->_methods)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('"%s" is an invalid form method', $method)); } $this->setAttrib('method', $method); @@ -913,8 +885,6 @@ public function setName($name) { $name = $this->filterName($name); if ('' === (string) $name) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid name provided; must contain only valid variable characters and be non-empty'); } @@ -1087,8 +1057,6 @@ public function addElement($element, $name = null, $options = null) { if (is_string($element)) { if (null === $name) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception( 'Elements specified by string must have an accompanying name' ); @@ -1115,8 +1083,6 @@ public function addElement($element, $name = null, $options = null) $this->_elements[$name] = $element; $this->_elements[$name]->addPrefixPaths($prefixPaths); } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception( 'Element must be specified by string or Zend_Form_Element instance' ); @@ -1146,14 +1112,10 @@ public function addElement($element, $name = null, $options = null) public function createElement($type, $name, $options = null) { if (!is_string($type)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Element type must be a string indicating type'); } if (!is_string($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Element name must be a string'); } @@ -1926,8 +1888,6 @@ public function addDisplayGroup(array $elements, $name, $options = null) } } if (empty($group)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('No valid elements specified for display group'); } @@ -1955,7 +1915,6 @@ public function addDisplayGroup(array $elements, $name, $options = null) } if (!class_exists($class)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($class); } $this->_displayGroups[$name] = new $class( @@ -1986,8 +1945,6 @@ protected function _addDisplayGroupObject(Zend_Form_DisplayGroup $group, $name = if (null === $name) { $name = $group->getName(); if ('' === (string) $name) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid display group added; requires name'); } } @@ -2371,11 +2328,8 @@ protected function _array_replace_recursive(array $into) public function isValid($data) { if (!is_array($data)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(__METHOD__ . ' expects an array'); } - $translator = $this->getTranslator(); $valid = true; $eBelongTo = null; @@ -2386,10 +2340,6 @@ public function isValid($data) $context = $data; /** @var Zend_Form_Element $element */ foreach ($this->getElements() as $key => $element) { - if (null !== $translator && $this->hasTranslator() - && !$element->hasTranslator()) { - $element->setTranslator($translator); - } $check = $data; if (($belongsTo = $element->getBelongsTo()) !== $eBelongTo) { $check = $this->_dissolveArrayValue($data, $belongsTo); @@ -2403,10 +2353,6 @@ public function isValid($data) } /** @var Zend_Form_SubForm $form */ foreach ($this->getSubForms() as $key => $form) { - if (null !== $translator && $this->hasTranslator() - && !$form->hasTranslator()) { - $form->setTranslator($translator); - } if (isset($data[$key]) && !$form->isArray()) { $valid = $form->isValid($data[$key]) && $valid; } else { @@ -2440,7 +2386,6 @@ public function isValidPartial(array $data) $data = $this->_dissolveArrayValue($data, $eBelongTo); } - $translator = $this->getTranslator(); $valid = true; $context = $data; @@ -2451,18 +2396,12 @@ public function isValidPartial(array $data) $check = $this->_dissolveArrayValue($data, $belongsTo); } if (isset($check[$key])) { - if (null !== $translator && !$element->hasTranslator()) { - $element->setTranslator($translator); - } $valid = $element->isValid($check[$key], $context) && $valid; $data = $this->_dissolveArrayUnsetKey($data, $belongsTo, $key); } } /** @var Zend_Form_SubForm $form */ foreach ($this->getSubForms() as $key => $form) { - if (null !== $translator && !$form->hasTranslator()) { - $form->setTranslator($translator); - } if (isset($data[$key]) && !$form->isArray()) { $valid = $form->isValidPartial($data[$key]) && $valid; } else { @@ -2486,7 +2425,6 @@ public function isValidPartial(array $data) */ public function processAjax(array $data) { - require_once 'Zend/Json.php'; if ($this->isValidPartial($data)) { return Zend_Json::encode(true); } @@ -2771,7 +2709,7 @@ public function getMessages($name = null, $suppressArrayNotation = false) } /** - * Retrieve translated custom error messages + * Retrieve custom error messages * Proxies to {@link _getErrorMessages()}. * * @return array @@ -2805,7 +2743,6 @@ public function setView(?Zend_View_Interface $view = null) public function getView() { if (null === $this->_view) { - require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $this->setView($viewRenderer->view); } @@ -2836,7 +2773,7 @@ protected function _getDecorator($name, $options) /** * Add a decorator for rendering the element. * - * @param string|Zend_Form_Decorator_Interface $decorator + * @param array|string|Zend_Form_Decorator_Interface $decorator * @param array|Zend_Config $options Options with which to initialize decorator * * @return Zend_Form @@ -2858,8 +2795,6 @@ public function addDecorator($decorator, $options = null) break; } if (is_numeric($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid alias provided to addDecorator; must be alphanumeric string'); } if (is_string($spec)) { @@ -2871,8 +2806,6 @@ public function addDecorator($decorator, $options = null) $decorator = $spec; } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator provided to addDecorator; must be string or Zend_Form_Decorator_Interface'); } @@ -2922,8 +2855,6 @@ public function addDecorators(array $decorators) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator passed to addDecorators()'); } } @@ -3147,137 +3078,6 @@ public function __toString() } } - // Localization: - - /** - * Set translator object. - * - * @param null|Zend_Translate|Zend_Translate_Adapter $translator - * - * @return Zend_Form - */ - public function setTranslator($translator = null) - { - if (null === $translator) { - $this->_translator = null; - } elseif ($translator instanceof Zend_Translate_Adapter) { - $this->_translator = $translator; - } elseif ($translator instanceof Zend_Translate) { - $this->_translator = $translator->getAdapter(); - } else { - require_once 'Zend/Form/Exception.php'; - - throw new Zend_Form_Exception('Invalid translator specified'); - } - - return $this; - } - - /** - * Set global default translator object. - * - * @param null|Zend_Translate|Zend_Translate_Adapter $translator - */ - public static function setDefaultTranslator($translator = null) - { - if (null === $translator) { - self::$_translatorDefault = null; - } elseif ($translator instanceof Zend_Translate_Adapter) { - self::$_translatorDefault = $translator; - } elseif ($translator instanceof Zend_Translate) { - self::$_translatorDefault = $translator->getAdapter(); - } else { - require_once 'Zend/Form/Exception.php'; - - throw new Zend_Form_Exception('Invalid translator specified'); - } - } - - /** - * Retrieve translator object. - * - * @return null|Zend_Translate - */ - public function getTranslator() - { - if ($this->translatorIsDisabled()) { - return null; - } - - if (null === $this->_translator) { - return self::getDefaultTranslator(); - } - - return $this->_translator; - } - - /** - * Does this form have its own specific translator? - * - * @return bool - */ - public function hasTranslator() - { - return (bool) $this->_translator; - } - - /** - * Get global default translator object. - * - * @return null|Zend_Translate - */ - public static function getDefaultTranslator() - { - if (null === self::$_translatorDefault) { - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered(\Zend_Translate::class)) { - $translator = Zend_Registry::get(\Zend_Translate::class); - if ($translator instanceof Zend_Translate_Adapter) { - return $translator; - } - if ($translator instanceof Zend_Translate) { - return $translator->getAdapter(); - } - } - } - - return self::$_translatorDefault; - } - - /** - * Is there a default translation object set? - * - * @return bool - */ - public static function hasDefaultTranslator() - { - return (bool) self::$_translatorDefault; - } - - /** - * Indicate whether or not translation should be disabled. - * - * @param bool $flag - * - * @return Zend_Form - */ - public function setDisableTranslator($flag) - { - $this->_translatorDisabled = (bool) $flag; - - return $this; - } - - /** - * Is translation disabled? - * - * @return bool - */ - public function translatorIsDisabled() - { - return $this->_translatorDisabled; - } - /** * Overloading: access to elements, form groups, and display groups. * @@ -3324,7 +3124,6 @@ public function __set($name, $value) return; } - require_once 'Zend/Form/Exception.php'; if (is_object($value)) { $type = get_class($value); } else { @@ -3396,13 +3195,9 @@ public function __call($method, $args) return $decorator->render($seed); } - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Decorator by name %s does not exist', $decoratorName)); } - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Method %s does not exist', $method)); } @@ -3428,7 +3223,6 @@ public function current(): mixed if (isset($this->_displayGroups[$key])) { return $this->getDisplayGroup($key); } - require_once 'Zend/Form/Exception.php'; throw new Zend_Form_Exception(sprintf('Corruption detected in form; invalid key ("%s") found in internal iterator', (string) $key)); } @@ -3618,19 +3412,13 @@ protected function _loadDecorator(array $decorator, $name) } /** - * Retrieve optionally translated custom error messages. + * Retrieve custom error messages. * * @return array */ protected function _getErrorMessages() { $messages = $this->getErrorMessages(); - $translator = $this->getTranslator(); - if (null !== $translator) { - foreach ($messages as $key => $message) { - $messages[$key] = $translator->translate($message); - } - } return $messages; } diff --git a/library/Zend/Form/Decorator/Abstract.php b/library/Zend/Form/Decorator/Abstract.php index c5ae495f3..7db5014ad 100644 --- a/library/Zend/Form/Decorator/Abstract.php +++ b/library/Zend/Form/Decorator/Abstract.php @@ -1,4 +1,5 @@ _callback = $callback; diff --git a/library/Zend/Form/Decorator/Captcha.php b/library/Zend/Form/Decorator/Captcha.php deleted file mode 100644 index 88dd40086..000000000 --- a/library/Zend/Form/Decorator/Captcha.php +++ /dev/null @@ -1,69 +0,0 @@ -getElement(); - if (!method_exists($element, 'getCaptcha')) { - return $content; - } - - $view = $element->getView(); - if (null === $view) { - return $content; - } - - $placement = $this->getPlacement(); - $separator = $this->getSeparator(); - - $captcha = $element->getCaptcha(); - $markup = $captcha->render($view, $element); - switch ($placement) { - case 'PREPEND': - $content = $markup . $separator . $content; - - break; - case 'APPEND': - default: - $content = $content . $separator . $markup; - } - - return $content; - } -} diff --git a/library/Zend/Form/Decorator/Captcha/Word.php b/library/Zend/Form/Decorator/Captcha/Word.php deleted file mode 100644 index 9f74a5078..000000000 --- a/library/Zend/Form/Decorator/Captcha/Word.php +++ /dev/null @@ -1,75 +0,0 @@ -getElement(); - $view = $element->getView(); - if (null === $view) { - return $content; - } - - $name = $element->getFullyQualifiedName(); - - $hiddenName = $name . '[id]'; - $textName = $name . '[input]'; - - $label = $element->getDecorator('Label'); - if ($label) { - $label->setOption('id', $element->getId() . '-input'); - } - - $placement = $this->getPlacement(); - $separator = $this->getSeparator(); - - $hidden = $view->formHidden($hiddenName, $element->getValue(), $element->getAttribs()); - $text = $view->formText($textName, '', $element->getAttribs()); - switch ($placement) { - case 'PREPEND': - $content = $hidden . $separator . $text . $separator . $content; - - break; - case 'APPEND': - default: - $content = $content . $separator . $hidden . $separator . $text; - } - - return $content; - } -} diff --git a/library/Zend/Form/Decorator/Description.php b/library/Zend/Form/Decorator/Description.php index 387c60df5..6c5d18d81 100644 --- a/library/Zend/Form/Decorator/Description.php +++ b/library/Zend/Form/Decorator/Description.php @@ -1,4 +1,5 @@ getDescription(); $description = trim($description ?? ''); - if (!empty($description) && (null !== ($translator = $element->getTranslator()))) { - $description = $translator->translate($description); - } - if (empty($description)) { return $content; } @@ -185,7 +181,6 @@ public function render($content) } if (!empty($tag)) { - require_once 'Zend/Form/Decorator/HtmlTag.php'; $options['tag'] = $tag; $decorator = new Zend_Form_Decorator_HtmlTag($options); $description = $decorator->render($description); diff --git a/library/Zend/Form/Decorator/DtDdWrapper.php b/library/Zend/Form/Decorator/DtDdWrapper.php index eaae07b35..f0a141aab 100644 --- a/library/Zend/Form/Decorator/DtDdWrapper.php +++ b/library/Zend/Form/Decorator/DtDdWrapper.php @@ -1,4 +1,5 @@ getTranslator())) { - $legend = $translator->translate($legend); - } - $attribs['legend'] = $legend; } diff --git a/library/Zend/Form/Decorator/File.php b/library/Zend/Form/Decorator/File.php index df120fe06..e26ddcfc9 100644 --- a/library/Zend/Form/Decorator/File.php +++ b/library/Zend/Form/Decorator/File.php @@ -1,4 +1,5 @@ getDisplayGroups() : []; $separator = $this->getSeparator(); - $translator = $form->getTranslator(); $items = []; $view = $form->getView(); foreach ($form as $item) { $item->setView($view); - // Set translator - if (!$item->hasTranslator()) { - $item->setTranslator($translator); - } - if ($item instanceof Zend_Form_Element) { foreach ($displayGroups as $group) { $elementName = $item->getName(); diff --git a/library/Zend/Form/Decorator/FormErrors.php b/library/Zend/Form/Decorator/FormErrors.php index ca64e30fc..11771f0f8 100644 --- a/library/Zend/Form/Decorator/FormErrors.php +++ b/library/Zend/Form/Decorator/FormErrors.php @@ -1,4 +1,5 @@ getLabel(); if (empty($label)) { $label = $element->getName(); - - // Translate element name - if (null !== ($translator = $element->getTranslator())) { - $label = $translator->translate($label); - } } if ($this->getEscape()) { diff --git a/library/Zend/Form/Decorator/HtmlTag.php b/library/Zend/Form/Decorator/HtmlTag.php index 790d34303..09f3c1b39 100644 --- a/library/Zend/Form/Decorator/HtmlTag.php +++ b/library/Zend/Form/Decorator/HtmlTag.php @@ -1,4 +1,5 @@ _tagFilter)) { - require_once 'Zend/Filter.php'; - require_once 'Zend/Filter/Alnum.php'; - require_once 'Zend/Filter/StringToLower.php'; $this->_tagFilter = new Zend_Filter(); $this->_tagFilter->addFilter(new Zend_Filter_Alnum()) ->addFilter(new Zend_Filter_StringToLower()); diff --git a/library/Zend/Form/Decorator/Image.php b/library/Zend/Form/Decorator/Image.php index 42f4e6baf..acfe6deba 100644 --- a/library/Zend/Form/Decorator/Image.php +++ b/library/Zend/Form/Decorator/Image.php @@ -1,4 +1,5 @@ formImage($name, $element->getImageValue(), $attribs); if (null !== $tag) { - require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); $decorator->setOptions(['tag' => $tag]); $image = $decorator->render($image); diff --git a/library/Zend/Form/Decorator/Interface.php b/library/Zend/Form/Decorator/Interface.php index df2595f83..0cb2409e0 100644 --- a/library/Zend/Form/Decorator/Interface.php +++ b/library/Zend/Form/Decorator/Interface.php @@ -1,4 +1,5 @@ _tagClass) { $decorator->setOptions(['tag' => $tag, diff --git a/library/Zend/Form/Decorator/Marker/File/Interface.php b/library/Zend/Form/Decorator/Marker/File/Interface.php index 9c7b315a3..ec49478c8 100644 --- a/library/Zend/Form/Decorator/Marker/File/Interface.php +++ b/library/Zend/Form/Decorator/Marker/File/Interface.php @@ -1,4 +1,5 @@ getElementsBelongTo() : null; - $elementContent = ''; $separator = $this->getSeparator(); - $translator = $form->getTranslator(); $view = $form->getView(); foreach ($form as $item) { - $item->setView($view) - ->setTranslator($translator); + $item->setView($view); if ($item instanceof Zend_Form_Element) { $item->setBelongsTo($belongsTo); } elseif (!empty($belongsTo) && ($item instanceof Zend_Form)) { diff --git a/library/Zend/Form/Decorator/Tooltip.php b/library/Zend/Form/Decorator/Tooltip.php index eebfc996c..0404106e6 100644 --- a/library/Zend/Form/Decorator/Tooltip.php +++ b/library/Zend/Form/Decorator/Tooltip.php @@ -1,4 +1,5 @@ getElement()->getAttrib('title'))) { - if (null !== ($translator = $this->getElement()->getTranslator())) { - $title = $translator->translate($title); - } - } - + $title = $this->getElement()->getAttrib('title'); $this->getElement()->setAttrib('title', $title); return $content; diff --git a/library/Zend/Form/Decorator/ViewHelper.php b/library/Zend/Form/Decorator/ViewHelper.php index bc61a26a2..9aa49d786 100644 --- a/library/Zend/Form/Decorator/ViewHelper.php +++ b/library/Zend/Form/Decorator/ViewHelper.php @@ -1,4 +1,5 @@ getView(); if (null === $view) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('ViewHelper decorator cannot render without a registered view object'); } @@ -241,11 +239,6 @@ public function render($content) $id = $element->getId(); $attribs['id'] = $id; - $helperObject = $view->getHelper($helper); - if (method_exists($helperObject, 'setTranslator')) { - $helperObject->setTranslator($element->getTranslator()); - } - // Check list separator if (isset($attribs['listsep']) && in_array($helper, ['formMultiCheckbox', 'formRadio', 'formSelect']) diff --git a/library/Zend/Form/Decorator/ViewScript.php b/library/Zend/Form/Decorator/ViewScript.php index 7f957c97e..01dd1de18 100644 --- a/library/Zend/Form/Decorator/ViewScript.php +++ b/library/Zend/Form/Decorator/ViewScript.php @@ -1,4 +1,5 @@ getViewScript(); if (empty($viewScript)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('No view script registered with ViewScript decorator'); } diff --git a/library/Zend/Form/DisplayGroup.php b/library/Zend/Form/DisplayGroup.php index c52cb6ab9..1110e2c38 100644 --- a/library/Zend/Form/DisplayGroup.php +++ b/library/Zend/Form/DisplayGroup.php @@ -1,4 +1,5 @@ $value) { $normalized = ucfirst($key); @@ -341,8 +330,6 @@ public function setName($name) { $name = $this->filtername($name); if (('0' !== $name) && empty($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid name provided; must contain only valid variable characters and be non-empty'); } @@ -501,8 +488,6 @@ public function addElements(array $elements) { foreach ($elements as $element) { if (!$element instanceof Zend_Form_Element) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('elements passed via array to addElements() must be Zend_Form_Elements only'); } $this->addElement($element); @@ -745,8 +730,6 @@ public function addDecorator($decorator, $options = null) break; } if (is_numeric($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid alias provided to addDecorator; must be alphanumeric string'); } if (is_string($spec)) { @@ -758,8 +741,6 @@ public function addDecorator($decorator, $options = null) $decorator = $spec; } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator provided to addDecorator; must be string or Zend_Form_Decorator_Interface'); } @@ -809,8 +790,6 @@ public function addDecorators(array $decorators) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator passed to addDecorators()'); } } @@ -937,7 +916,6 @@ public function setView(?Zend_View_Interface $view = null) public function getView() { if (null === $this->_view) { - require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $this->setView($viewRenderer->view); } @@ -982,82 +960,6 @@ public function __toString() } } - /** - * Set translator object. - * - * @param null|Zend_Translate|Zend_Translate_Adapter $translator - * - * @return Zend_Form_DisplayGroup - */ - public function setTranslator($translator = null) - { - if ((null === $translator) || ($translator instanceof Zend_Translate_Adapter)) { - $this->_translator = $translator; - } elseif ($translator instanceof Zend_Translate) { - $this->_translator = $translator->getAdapter(); - } else { - require_once 'Zend/Form/Exception.php'; - - throw new Zend_Form_Exception('Invalid translator specified'); - } - - return $this; - } - - /** - * Retrieve translator object. - * - * @return null|Zend_Translate_Adapter - */ - public function getTranslator() - { - if ($this->translatorIsDisabled()) { - return null; - } - - if (null === $this->_translator) { - require_once 'Zend/Form.php'; - - return Zend_Form::getDefaultTranslator(); - } - - return $this->_translator; - } - - /** - * Does this display group have its own specific translator? - * - * @return bool - */ - public function hasTranslator() - { - return (bool) $this->getTranslator(); - } - - /** - * Indicate whether or not translation should be disabled. - * - * @param bool $flag - * - * @return Zend_Form_DisplayGroup - */ - public function setDisableTranslator($flag) - { - $this->_translatorDisabled = (bool) $flag; - - return $this; - } - - /** - * Is translation disabled? - * - * @return bool - */ - public function translatorIsDisabled() - { - return $this->_translatorDisabled; - } - /** * Overloading: allow rendering specific decorators. * @@ -1082,13 +984,9 @@ public function __call($method, $args) return $decorator->render($seed); } - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Decorator by name %s does not exist', $decoratorName)); } - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Method %s does not exist', $method)); } diff --git a/library/Zend/Form/Element.php b/library/Zend/Form/Element.php index b2d9083f7..8bd9276d1 100644 --- a/library/Zend/Form/Element.php +++ b/library/Zend/Form/Element.php @@ -1,4 +1,5 @@ getName()) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Zend_Form_Element requires each element to have a name'); } @@ -375,17 +358,12 @@ public function setOptions(array $options) unset($options['prefixPath']); } - if (isset($options['disableTranslator'])) { - $this->setDisableTranslator($options['disableTranslator']); - unset($options['disableTranslator']); - } - unset($options['options'], $options['config']); foreach ($options as $key => $value) { $method = 'set' . ucfirst($key); - if (in_array($method, ['setTranslator', 'setPluginLoader', 'setView'])) { + if (in_array($method, ['setPluginLoader', 'setView'])) { if (!is_object($value)) { continue; } @@ -413,84 +391,6 @@ public function setConfig(Zend_Config $config) return $this->setOptions($config->toArray()); } - // Localization: - - /** - * Set translator object for localization. - * - * @param null|Zend_Translate $translator - * - * @return Zend_Form_Element - */ - public function setTranslator($translator = null) - { - if (null === $translator) { - $this->_translator = null; - } elseif ($translator instanceof Zend_Translate_Adapter) { - $this->_translator = $translator; - } elseif ($translator instanceof Zend_Translate) { - $this->_translator = $translator->getAdapter(); - } else { - require_once 'Zend/Form/Exception.php'; - - throw new Zend_Form_Exception('Invalid translator specified'); - } - - return $this; - } - - /** - * Retrieve localization translator object. - * - * @return null|Zend_Translate_Adapter - */ - public function getTranslator() - { - if ($this->translatorIsDisabled()) { - return null; - } - - if (null === $this->_translator) { - return Zend_Form::getDefaultTranslator(); - } - - return $this->_translator; - } - - /** - * Does this element have its own specific translator? - * - * @return bool - */ - public function hasTranslator() - { - return (bool) $this->_translator; - } - - /** - * Indicate whether or not translation should be disabled. - * - * @param bool $flag - * - * @return Zend_Form_Element - */ - public function setDisableTranslator($flag) - { - $this->_translatorDisabled = (bool) $flag; - - return $this; - } - - /** - * Is translation disabled? - * - * @return bool - */ - public function translatorIsDisabled() - { - return $this->_translatorDisabled; - } - // Metadata /** @@ -522,8 +422,6 @@ public function setName($name) { $name = $this->filterName($name); if ('' === $name) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid name provided; must contain only valid variable characters and be non-empty'); } @@ -669,11 +567,6 @@ public function setLabel($label) */ public function getLabel() { - $translator = $this->getTranslator(); - if (null !== $translator) { - return $translator->translate($this->_label); - } - return $this->_label; } @@ -901,8 +794,6 @@ public function setAttrib($name, $value) { $name = (string) $name; if ('_' == $name[0]) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid attribute "%s"; must not contain a leading underscore', $name)); } @@ -934,7 +825,7 @@ public function setAttribs(array $attribs) * * @param string $name * - * @return string + * @return ?string */ public function getAttrib($name) { @@ -1000,8 +891,6 @@ public function getConcatJustValuesInErrorMessage() public function __get($key) { if ('_' == $key[0]) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Cannot retrieve value for protected/private property "%s"', $key)); } @@ -1052,13 +941,9 @@ public function __call($method, $args) return $decorator->render($seed); } - require_once 'Zend/Form/Element/Exception.php'; - throw new Zend_Form_Element_Exception(sprintf('Decorator by name %s does not exist', $decoratorName)); } - require_once 'Zend/Form/Element/Exception.php'; - throw new Zend_Form_Element_Exception(sprintf('Method %s does not exist', $method)); } @@ -1082,8 +967,6 @@ public function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader, $typ return $this; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to setPluginLoader()', $type)); } } @@ -1114,7 +997,6 @@ public function getPluginLoader($type) $pathSegment = 'Form/Decorator'; } if (!isset($this->_loaders[$type])) { - require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader( ['Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/'] ); @@ -1122,8 +1004,6 @@ public function getPluginLoader($type) return $this->_loaders[$type]; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -1169,8 +1049,6 @@ public function addPrefixPath($prefix, $path, $type = null) return $this; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -1246,8 +1124,6 @@ public function addValidator($validator, $breakChainOnFailure = false, $options 'options' => $options, ]; } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid validator provided to addValidator; must be string or Zend_Validate_Interface'); } @@ -1301,8 +1177,6 @@ public function addValidators(array $validators) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid validator passed to addValidators()'); } } @@ -1420,11 +1294,6 @@ public function clearValidators() /** * Validate element value. * - * If a translation adapter is registered, any error messages will be - * translated according to the current locale, using the given error code; - * if no matching translation is found, the original message will be - * utilized. - * * Note: The *filtered* value is validated. * * @param mixed $value @@ -1453,39 +1322,11 @@ public function isValid($value, $context = null) $this->setValidators($validators); } - // Find the correct translator. Zend_Validate_Abstract::getDefaultTranslator() - // will get either the static translator attached to Zend_Validate_Abstract - // or the 'Zend_Translate' from Zend_Registry. - if (Zend_Validate_Abstract::hasDefaultTranslator() - && !Zend_Form::hasDefaultTranslator()) { - $translator = Zend_Validate_Abstract::getDefaultTranslator(); - if ($this->hasTranslator()) { - // only pick up this element's translator if it was attached directly. - $translator = $this->getTranslator(); - } - } else { - $translator = $this->getTranslator(); - } - $this->_messages = []; $this->_errors = []; $result = true; $isArray = $this->isArray(); foreach ($this->getValidators() as $key => $validator) { - if (method_exists($validator, 'setTranslator')) { - if (method_exists($validator, 'hasTranslator')) { - if (!$validator->hasTranslator()) { - $validator->setTranslator($translator); - } - } else { - $validator->setTranslator($translator); - } - } - - if (method_exists($validator, 'setDisableTranslator')) { - $validator->setDisableTranslator($this->translatorIsDisabled()); - } - if ($isArray && is_array($value)) { $messages = []; $errors = []; @@ -1740,8 +1581,6 @@ public function addFilter($filter, $options = []) ]; $this->_filters[$name] = $filter; } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid filter provided to addFilter; must be string or Zend_Filter_Interface'); } @@ -1788,8 +1627,6 @@ public function addFilters(array $filters) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid filter passed to addFilters()'); } } @@ -1929,7 +1766,6 @@ public function setView(?Zend_View_Interface $view = null) public function getView() { if (null === $this->_view) { - require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $this->setView($viewRenderer->view); } @@ -1982,8 +1818,6 @@ public function addDecorator($decorator, $options = null) break; } if (is_numeric($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid alias provided to addDecorator; must be alphanumeric string'); } if (is_string($spec)) { @@ -1995,8 +1829,6 @@ public function addDecorator($decorator, $options = null) $decorator = $spec; } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator provided to addDecorator; must be string or Zend_Form_Decorator_Interface'); } @@ -2046,8 +1878,6 @@ public function addDecorators(array $decorators) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator passed to addDecorators()'); } } @@ -2213,8 +2043,6 @@ protected function _loadFilter(array $filter) $name = $this->getPluginLoader(self::FILTER)->load($filter['filter']); if (array_key_exists($name, $this->_filters)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Filter instance already exists for filter "%s"', $origName)); } @@ -2265,8 +2093,6 @@ protected function _loadValidator(array $validator) $name = $this->getPluginLoader(self::VALIDATE)->load($validator['validator']); if (array_key_exists($name, $this->_validators)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Validator instance already exists for validator "%s"', $origName)); } @@ -2376,19 +2202,15 @@ protected function _loadDecorator(array $decorator, $name) } /** - * Retrieve error messages and perform translation and value substitution. + * Retrieve error messages and perform value substitution. * * @return array */ protected function _getErrorMessages() { - $translator = $this->getTranslator(); $messages = $this->getErrorMessages(); $value = $this->getValue(); foreach ($messages as $key => $message) { - if (null !== $translator) { - $message = $translator->translate($message); - } if ($this->isArray() || is_array($value)) { $aggregateMessages = []; foreach ($value as $val) { diff --git a/library/Zend/Form/Element/Button.php b/library/Zend/Form/Element/Button.php index de89e853a..0716eca62 100644 --- a/library/Zend/Form/Element/Button.php +++ b/library/Zend/Form/Element/Button.php @@ -1,4 +1,5 @@ _captcha; - } - - /** - * Set captcha adapter. - * - * @param array|string|Zend_Captcha_Adapter $captcha - * @param array $options - */ - public function setCaptcha($captcha, $options = []) - { - if ($captcha instanceof Zend_Captcha_Adapter) { - $instance = $captcha; - } else { - if (is_array($captcha)) { - if (array_key_exists('captcha', $captcha)) { - $name = $captcha['captcha']; - unset($captcha['captcha']); - } else { - $name = array_shift($captcha); - } - $options = array_merge($options, $captcha); - } else { - $name = $captcha; - } - - $name = $this->getPluginLoader(self::CAPTCHA)->load($name); - if (empty($options)) { - $instance = new $name(); - } else { - $r = new ReflectionClass($name); - if ($r->hasMethod('__construct')) { - $instance = $r->newInstanceArgs([$options]); - } else { - $instance = $r->newInstance(); - } - } - } - - $this->_captcha = $instance; - $this->_captcha->setName($this->getName()); - - return $this; - } - - /** - * Constructor. - * - * $spec may be: - * - string: name of element - * - array: options with which to configure element - * - Zend_Config: Zend_Config with options for configuring element - * - * @param array|string|Zend_Config $spec - * @param null|mixed $options - */ - public function __construct($spec, $options = null) - { - parent::__construct($spec, $options); - $this->setAllowEmpty(true) - ->setRequired(true) - ->setAutoInsertNotEmptyValidator(false) - ->addValidator($this->getCaptcha(), true); - } - - /** - * Set options. - * - * Overrides to allow passing captcha options - * - * @return Zend_Form_Element_Captcha - */ - public function setOptions(array $options) - { - $captcha = null; - $captchaOptions = []; - - if (array_key_exists('captcha', $options)) { - $captcha = $options['captcha']; - if (array_key_exists('captchaOptions', $options)) { - $captchaOptions = $options['captchaOptions']; - unset($options['captchaOptions']); - } - unset($options['captcha']); - } - parent::setOptions($options); - - if (null !== $captcha) { - $this->setCaptcha($captcha, $captchaOptions); - } - - return $this; - } - - /** - * Render form element. - * - * @return string - */ - public function render(?Zend_View_Interface $view = null) - { - $captcha = $this->getCaptcha(); - $captcha->setName($this->getFullyQualifiedName()); - - if (!$this->loadDefaultDecoratorsIsDisabled()) { - $decorators = $this->getDecorators(); - $decorator = $captcha->getDecorator(); - $key = get_class($this->_getDecorator($decorator, null)); - - if (!empty($decorator) && !array_key_exists($key, $decorators)) { - array_unshift($decorators, $decorator); - } - - $decorator = ['Captcha', ['captcha' => $captcha]]; - $key = get_class($this->_getDecorator($decorator[0], $decorator[1])); - - if ($captcha instanceof Zend_Captcha_Word && !array_key_exists($key, $decorators)) { - array_unshift($decorators, $decorator); - } - - $this->setDecorators($decorators); - } - - $this->setValue($this->getCaptcha()->generate()); - - return parent::render($view); - } - - /** - * Retrieve plugin loader for validator or filter chain. - * - * Support for plugin loader for Captcha adapters - * - * @param string $type - * - * @return Zend_Loader_PluginLoader - */ - public function getPluginLoader($type) - { - $type = strtoupper($type); - if ($type == self::CAPTCHA) { - if (!isset($this->_loaders[$type])) { - require_once 'Zend/Loader/PluginLoader.php'; - $this->_loaders[$type] = new Zend_Loader_PluginLoader( - ['Zend_Captcha' => 'Zend/Captcha/'] - ); - } - - return $this->_loaders[$type]; - } - - return parent::getPluginLoader($type); - } - - /** - * Add prefix path for plugin loader for captcha adapters. - * - * This method handles the captcha type, the rest is handled by - * the parent - * - * @param string $prefix - * @param string $path - * @param string $type - * - * @return Zend_Form_Element - * - * @see Zend_Form_Element::addPrefixPath - */ - public function addPrefixPath($prefix, $path, $type = null) - { - $type = strtoupper($type); - switch ($type) { - case null: - $loader = $this->getPluginLoader(self::CAPTCHA); - $nsSeparator = (false !== strpos($prefix, '\\')) ? '\\' : '_'; - $cPrefix = rtrim($prefix, $nsSeparator) . $nsSeparator . 'Captcha'; - $cPath = rtrim($path, '/\\') . '/Captcha'; - $loader->addPrefixPath($cPrefix, $cPath); - - return parent::addPrefixPath($prefix, $path); - case self::CAPTCHA: - $loader = $this->getPluginLoader($type); - $loader->addPrefixPath($prefix, $path); - - return $this; - default: - return parent::addPrefixPath($prefix, $path, $type); - } - } - - /** - * Load default decorators. - * - * @return Zend_Form_Element_Captcha - */ - public function loadDefaultDecorators() - { - if ($this->loadDefaultDecoratorsIsDisabled()) { - return $this; - } - - $decorators = $this->getDecorators(); - if (empty($decorators)) { - $this->addDecorator('Errors') - ->addDecorator('Description', ['tag' => 'p', 'class' => 'description']) - ->addDecorator('HtmlTag', ['tag' => 'dd', 'id' => $this->getName() . '-element']) - ->addDecorator('Label', ['tag' => 'dt']); - } - - return $this; - } - - /** - * Is the captcha valid? - * - * @param mixed $value - * @param mixed $context - * - * @return bool - */ - public function isValid($value, $context = null) - { - $this->getCaptcha()->setName($this->getName()); - $belongsTo = $this->getBelongsTo(); - if (empty($belongsTo) || !is_array($context)) { - return parent::isValid($value, $context); - } - - $name = $this->getFullyQualifiedName(); - $root = substr($name, 0, strpos($name, '[')); - $segments = substr($name, strpos($name, '[')); - $segments = ltrim($segments, '['); - $segments = rtrim($segments, ']'); - $segments = explode('][', $segments); - array_unshift($segments, $root); - array_pop($segments); - $newContext = $context; - foreach ($segments as $segment) { - if (array_key_exists($segment, $newContext)) { - $newContext = $newContext[$segment]; - } - } - - return parent::isValid($value, $newContext); - } -} diff --git a/library/Zend/Form/Element/Checkbox.php b/library/Zend/Form/Element/Checkbox.php index cadf498eb..8b80fc1fe 100644 --- a/library/Zend/Form/Element/Checkbox.php +++ b/library/Zend/Form/Element/Checkbox.php @@ -1,4 +1,5 @@ _loaders)) { - require_once 'Zend/Loader/PluginLoader.php'; $loader = new Zend_Loader_PluginLoader([ 'Zend_File_Transfer_Adapter' => 'Zend/File/Transfer/Adapter/', ]); @@ -185,8 +184,6 @@ public function setTransferAdapter($adapter) $class = $loader->load($adapter); $this->_adapter = new $class(); } else { - require_once 'Zend/Form/Element/Exception.php'; - throw new Zend_Form_Element_Exception('Invalid adapter specified'); } @@ -323,7 +320,7 @@ public function clearValidators() /** * Add Filter; proxy to adapter. * - * @param array|string $filter Type of filter to add + * @param array|string|Zend_Filter_Interface $filter Type of filter to add * @param array|string $options Options to set for the filter * * @return Zend_Form_Element_File @@ -438,11 +435,6 @@ public function isValid($value, $context = null) } $adapter = $this->getTransferAdapter(); - $translator = $this->getTranslator(); - if ($translator !== null) { - $adapter->setTranslator($translator); - } - if (!$this->isRequired()) { $adapter->setOptions(['ignoreNoFile' => true], $this->getName()); } else { @@ -755,71 +747,6 @@ public function setValue($value) return $this; } - /** - * Set translator object for localization. - * - * @param null|Zend_Translate $translator - * - * @return Zend_Form_Element_File - */ - public function setTranslator($translator = null) - { - $adapter = $this->getTransferAdapter(); - $adapter->setTranslator($translator); - parent::setTranslator($translator); - - return $this; - } - - /** - * Retrieve localization translator object. - * - * @return null|Zend_Translate_Adapter - */ - public function getTranslator() - { - if ($this->translatorIsDisabled()) { - return null; - } - - $translator = $this->getTransferAdapter()->getTranslator(); - if (null === $translator) { - require_once 'Zend/Form.php'; - - return Zend_Form::getDefaultTranslator(); - } - - return $translator; - } - - /** - * Indicate whether or not translation should be disabled. - * - * @param bool $flag - * - * @return Zend_Form_Element_File - */ - public function setDisableTranslator($flag) - { - $adapter = $this->getTransferAdapter(); - $adapter->setDisableTranslator($flag); - $this->_translatorDisabled = (bool) $flag; - - return $this; - } - - /** - * Is translation disabled? - * - * @return bool - */ - public function translatorIsDisabled() - { - $adapter = $this->getTransferAdapter(); - - return $adapter->translatorIsDisabled(); - } - /** * Was the file received? * @@ -910,8 +837,6 @@ public function render(?Zend_View_Interface $view = null) } if (!$marker) { - require_once 'Zend/Form/Element/Exception.php'; - throw new Zend_Form_Element_Exception('No file decorator found... unable to render file element'); } @@ -919,20 +844,15 @@ public function render(?Zend_View_Interface $view = null) } /** - * Retrieve error messages and perform translation and value substitution. + * Retrieve error messages and perform value substitution. * * @return array */ protected function _getErrorMessages() { - $translator = $this->getTranslator(); $messages = $this->getErrorMessages(); $value = $this->getFileName(); foreach ($messages as $key => $message) { - if (null !== $translator) { - $message = $translator->translate($message); - } - if ($this->isArray() || is_array($value)) { $aggregateMessages = []; foreach ($value as $val) { diff --git a/library/Zend/Form/Element/Hash.php b/library/Zend/Form/Element/Hash.php index 27d803dab..1a06f517a 100644 --- a/library/Zend/Form/Element/Hash.php +++ b/library/Zend/Form/Element/Hash.php @@ -1,4 +1,5 @@ _session) { - require_once 'Zend/Session/Namespace.php'; $this->_session = new Zend_Session_Namespace($this->getSessionName()); } diff --git a/library/Zend/Form/Element/Hidden.php b/library/Zend/Form/Element/Hidden.php index f1e48a804..be5e5ac99 100644 --- a/library/Zend/Form/Element/Hidden.php +++ b/library/Zend/Form/Element/Hidden.php @@ -1,4 +1,5 @@ '; - /** - * Which values are translated already? - * - * @var array - */ - protected $_translated = []; - /** * Retrieve separator. * @@ -97,8 +90,8 @@ protected function _getMultiOptions() /** * Add an option. * - * @param string $option - * @param string $value + * @param string $option + * @param string $value * * @return Zend_Form_Element_Multi */ @@ -106,9 +99,7 @@ public function addMultiOption($option, $value = '') { $option = (string) $option; $this->_getMultiOptions(); - if (!$this->_translateOption($option, $value)) { - $this->options[$option] = $value; - } + $this->options[$option] = $value; return $this; } @@ -149,7 +140,7 @@ public function setMultiOptions(array $options) /** * Retrieve single multi option. * - * @param string $option + * @param string $option * * @return mixed */ @@ -158,8 +149,6 @@ public function getMultiOption($option) $option = (string) $option; $this->_getMultiOptions(); if (isset($this->options[$option])) { - $this->_translateOption($option, $this->options[$option]); - return $this->options[$option]; } @@ -174,9 +163,6 @@ public function getMultiOption($option) public function getMultiOptions() { $this->_getMultiOptions(); - foreach ($this->options as $option => $value) { - $this->_translateOption($option, $value); - } return $this->options; } @@ -184,7 +170,7 @@ public function getMultiOptions() /** * Remove a single multi option. * - * @param string $option + * @param string $option * * @return bool */ @@ -194,9 +180,6 @@ public function removeMultiOption($option) $this->_getMultiOptions(); if (isset($this->options[$option])) { unset($this->options[$option]); - if (isset($this->_translated[$option])) { - unset($this->_translated[$option]); - } return true; } @@ -212,7 +195,6 @@ public function removeMultiOption($option) public function clearMultiOptions() { $this->options = []; - $this->_translated = []; return $this; } @@ -220,7 +202,7 @@ public function clearMultiOptions() /** * Set flag indicating whether or not to auto-register inArray validator. * - * @param bool $flag + * @param bool $flag * * @return Zend_Form_Element_Multi */ @@ -246,8 +228,8 @@ public function registerInArrayValidator() * * Autoregisters InArray validator if necessary. * - * @param string $value - * @param mixed $context + * @param string $value + * @param mixed $context * * @return bool */ @@ -277,54 +259,4 @@ public function isValid($value, $context = null) return parent::isValid($value, $context); } - - /** - * Translate an option. - * - * @param string $option - * @param string $value - * - * @return bool - */ - protected function _translateOption($option, $value) - { - if ($this->translatorIsDisabled()) { - return false; - } - - if (!isset($this->_translated[$option]) && !empty($value)) { - $this->options[$option] = $this->_translateValue($value); - if ($this->options[$option] === $value) { - return false; - } - $this->_translated[$option] = true; - - return true; - } - - return false; - } - - /** - * Translate a multi option value. - * - * @param string $value - * - * @return string - */ - protected function _translateValue($value) - { - if (is_array($value)) { - foreach ($value as $key => $val) { - $value[$key] = $this->_translateValue($val); - } - - return $value; - } - if (null !== ($translator = $this->getTranslator())) { - return $translator->translate($value); - } - - return $value; - } } diff --git a/library/Zend/Form/Element/MultiCheckbox.php b/library/Zend/Form/Element/MultiCheckbox.php index aae1e2f85..5a1ebceca 100644 --- a/library/Zend/Form/Element/MultiCheckbox.php +++ b/library/Zend/Form/Element/MultiCheckbox.php @@ -1,4 +1,5 @@ getName(); - - if (null !== ($translator = $this->getTranslator())) { - return $translator->translate($value); - } } return $value; diff --git a/library/Zend/Form/Element/Text.php b/library/Zend/Form/Element/Text.php index d22a5a491..eb44fb8cd 100644 --- a/library/Zend/Form/Element/Text.php +++ b/library/Zend/Form/Element/Text.php @@ -1,4 +1,5 @@ 5, - 'strictredirects' => false, - 'useragent' => \Zend_Http_Client::class, - 'timeout' => 10, - 'adapter' => \Zend_Http_Client_Adapter_Socket::class, - 'httpversion' => self::HTTP_1, - 'keepalive' => false, - 'storeresponse' => true, - 'strict' => true, - 'output_stream' => false, - 'encodecookies' => true, - 'rfc3986_strict' => false, - ]; - - /** - * The adapter used to perform the actual connection to the server. - * - * @var Zend_Http_Client_Adapter_Interface - */ - protected $adapter; - - /** - * Request URI. - * - * @var Zend_Uri_Http - */ - protected $uri; - - /** - * Associative array of request headers. - * - * @var array - */ - protected $headers = []; - - /** - * HTTP request method. - * - * @var string - */ - protected $method = self::GET; - - /** - * Associative array of GET parameters. - * - * @var array - */ - protected $paramsGet = []; - - /** - * Associative array of POST parameters. - * - * @var array - */ - protected $paramsPost = []; - - /** - * Request body content type (for POST requests). - * - * @var string - */ - protected $enctype; - - /** - * The raw post data to send. Could be set by setRawData($data, $enctype). - * - * @var string - */ - protected $raw_post_data; - - /** - * HTTP Authentication settings. - * - * Expected to be an associative array with this structure: - * $this->auth = array('user' => 'username', 'password' => 'password', 'type' => 'basic') - * Where 'type' should be one of the supported authentication types (see the AUTH_* - * constants), for example 'basic' or 'digest'. - * - * If null, no authentication will be used. - * - * @var null|array - */ - protected $auth; - - /** - * File upload arrays (used in POST requests). - * - * An associative array, where each element is of the format: - * 'name' => array('filename.txt', 'text/plain', 'This is the actual file contents') - * - * @var array - */ - protected $files = []; - - /** - * Ordered list of keys from key/value pair data to include in body. - * - * An associative array, where each element is of the format: - * '' => VTYPE_SCALAR | VTYPE_FILE - * - * @var array - */ - protected $body_field_order = []; - - /** - * The client's cookie jar. - * - * @var Zend_Http_CookieJar - */ - protected $cookiejar; - - /** - * The last HTTP request sent by the client, as string. - * - * @var string - */ - protected $last_request; - - /** - * The last HTTP response received by the client. - * - * @var Zend_Http_Response - */ - protected $last_response; - - /** - * Redirection counter. - * - * @var int - */ - protected $redirectCounter = 0; - - /** - * Status for unmasking GET array params. - * - * @var bool - */ - protected $_unmaskStatus = false; - - /** - * Status if the http_build_query function escapes brackets. - * - * @var bool - */ - protected $_queryBracketsEscaped = true; - - /** - * Fileinfo magic database resource. - * - * This variable is populated the first time _detectFileMimeType is called - * and is then reused on every call to this method - * - * @var resource - */ - protected static $_fileInfoDb; - - /** - * Constructor method. Will create a new HTTP client. Accepts the target - * URL and optionally configuration array. - * - * @param string|Zend_Uri_Http $uri - * @param array $config configuration key-value pairs - */ - public function __construct($uri = null, $config = null) - { - if ($uri !== null) { - $this->setUri($uri); - } - if ($config !== null) { - $this->setConfig($config); - } - - $this->_queryBracketsEscaped = version_compare(phpversion(), '5.1.3', '>='); - } - - /** - * Set the URI for the next request. - * - * @param string|Zend_Uri_Http $uri - * - * @return Zend_Http_Client - */ - public function setUri($uri) - { - if ($uri instanceof Zend_Uri_Http) { - // clone the URI in order to keep the passed parameter constant - $uri = clone $uri; - } elseif (is_string($uri)) { - $uri = Zend_Uri::factory($uri); - } - - if (!$uri instanceof Zend_Uri_Http) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception('Passed parameter is not a valid HTTP URI.'); - } - - // Set auth if username and password has been specified in the uri - if ($uri->getUsername() && $uri->getPassword()) { - $this->setAuth($uri->getUsername(), $uri->getPassword()); - } - - // We have no ports, set the defaults - if (!$uri->getPort()) { - $uri->setPort(($uri->getScheme() == 'https' ? 443 : 80)); - } - - $this->uri = $uri; - - return $this; - } - - /** - * Get the URI for the next request. - * - * @param bool $as_string If true, will return the URI as a string - * - * @return string|Zend_Uri_Http - */ - public function getUri($as_string = false) - { - if ($as_string && $this->uri instanceof Zend_Uri_Http) { - return $this->uri->__toString(); - } - - return $this->uri; - } - - /** - * Set configuration parameters for this HTTP client. - * - * @param array|Zend_Config $config - * - * @return Zend_Http_Client - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception('Array or Zend_Config object expected, got ' . gettype($config)); - } - - foreach ($config as $k => $v) { - $this->config[strtolower($k)] = $v; - } - - // Pass configuration options to the adapter if it exists - if ($this->adapter instanceof Zend_Http_Client_Adapter_Interface) { - $this->adapter->setConfig($config); - } - - return $this; - } - - /** - * Set the next request's method. - * - * Validated the passed method and sets it. If we have files set for - * POST requests, and the new method is not POST, the files are silently - * dropped. - * - * @param string $method - * - * @return Zend_Http_Client - */ - public function setMethod($method = self::GET) - { - if (!preg_match('/^[^\x00-\x1f\x7f-\xff\(\)<>@,;:\\\\"\/\[\]\?={}\s]+$/', $method)) { - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("'{$method}' is not a valid HTTP request method."); - } - - if (($method == self::POST - || $method == self::PUT - || $method == self::DELETE - || $method == self::PATCH - || $method == self::OPTIONS) - && $this->enctype === null - ) { - $this->setEncType(self::ENC_URLENCODED); - } - - $this->method = $method; - - return $this; - } - - /** - * Set one or more request headers. - * - * This function can be used in several ways to set the client's request - * headers: - * 1. By providing two parameters: $name as the header to set (e.g. 'Host') - * and $value as it's value (e.g. 'www.example.com'). - * 2. By providing a single header string as the only parameter - * e.g. 'Host: www.example.com' - * 3. By providing an array of headers as the first parameter - * e.g. array('host' => 'www.example.com', 'x-foo: bar'). In This case - * the function will call itself recursively for each array item. - * - * @param array|string $name Header name, full header string ('Header: value') - * or an array of headers - * @param mixed $value Header value or null - * - * @return Zend_Http_Client - */ - public function setHeaders($name, $value = null) - { - // If we got an array, go recursive! - if (is_array($name)) { - foreach ($name as $k => $v) { - if (is_string($k)) { - $this->setHeaders($k, $v); - - continue; - } - $this->setHeaders($v, null); - } - - return $this; - } - - // Check if $name needs to be split - if ($value === null && (strpos($name, ':') > 0)) { - [$name, $value] = explode(':', $name, 2); - } - - // Make sure the name is valid if we are in strict mode - if ($this->config['strict'] && (!preg_match('/^[a-zA-Z0-9-]+$/', $name))) { - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("{$name} is not a valid HTTP header name"); - } - - $normalized_name = strtolower($name); - - // If $value is null or false, unset the header - if ($value === null || $value === false) { - unset($this->headers[$normalized_name]); - - return $this; - } - - // Validate value - $this->_validateHeaderValue($value); - - // Header names are stored lowercase internally. - if (is_string($value)) { - $value = trim($value); - } - $this->headers[$normalized_name] = [$name, $value]; - - return $this; - } - - /** - * Get the value of a specific header. - * - * Note that if the header has more than one value, an array - * will be returned. - * - * @param string $key - * - * @return null|array|string The header value or null if it is not set - */ - public function getHeader($key) - { - $key = strtolower($key); - if (isset($this->headers[$key])) { - return $this->headers[$key][1]; - } - - return null; - } - - /** - * Set a GET parameter for the request. Wrapper around _setParameter. - * - * @param array|string $name - * @param string $value - * - * @return Zend_Http_Client - */ - public function setParameterGet($name, $value = null) - { - if (is_array($name)) { - foreach ($name as $k => $v) { - $this->_setParameter('GET', $k, $v); - } - } else { - $this->_setParameter('GET', $name, $value); - } - - return $this; - } - - /** - * Set a POST parameter for the request. Wrapper around _setParameter. - * - * @param array|string $name - * @param string $value - * - * @return Zend_Http_Client - */ - public function setParameterPost($name, $value = null) - { - if (is_array($name)) { - foreach ($name as $k => $v) { - $this->_setParameter('POST', $k, $v); - } - } else { - $this->_setParameter('POST', $name, $value); - } - - return $this; - } - - /** - * Set a GET or POST parameter - used by SetParameterGet and SetParameterPost. - * - * @param string $type GET or POST - * @param string $name - * @param string $value - */ - protected function _setParameter($type, $name, $value) - { - $parray = []; - $type = strtolower($type); - switch ($type) { - case 'get': - $parray = &$this->paramsGet; - - break; - case 'post': - $parray = &$this->paramsPost; - if ($value === null) { - if (isset($this->body_field_order[$name])) { - unset($this->body_field_order[$name]); - } - } else { - $this->body_field_order[$name] = self::VTYPE_SCALAR; - } - - break; - } - - if ($value === null) { - if (isset($parray[$name])) { - unset($parray[$name]); - } - } else { - $parray[$name] = $value; - } - } - - /** - * Get the number of redirections done on the last request. - * - * @return int - */ - public function getRedirectionsCount() - { - return $this->redirectCounter; - } - - /** - * Set HTTP authentication parameters. - * - * $type should be one of the supported types - see the self::AUTH_* - * constants. - * - * To enable authentication: - * - * $this->setAuth('shahar', 'secret', Zend_Http_Client::AUTH_BASIC); - * - * - * To disable authentication: - * - * $this->setAuth(false); - * - * - * @see http://www.faqs.org/rfcs/rfc2617.html - * - * @param false|string $user User name or false disable authentication - * @param string $password Password - * @param string $type Authentication type - * - * @return Zend_Http_Client - */ - public function setAuth($user, $password = '', $type = self::AUTH_BASIC) - { - // If we got false or null, disable authentication - if ($user === false || $user === null) { - $this->auth = null; - - // Clear the auth information in the uri instance as well - if ($this->uri instanceof Zend_Uri_Http) { - $this->getUri()->setUsername(''); - $this->getUri()->setPassword(''); - } - // Else, set up authentication - } else { - // Check we got a proper authentication type - if (!defined('self::AUTH_' . strtoupper($type))) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("Invalid or not supported authentication type: '$type'"); - } - - $this->auth = [ - 'user' => (string) $user, - 'password' => (string) $password, - 'type' => $type, - ]; - } - - return $this; - } - - /** - * Set the HTTP client's cookie jar. - * - * A cookie jar is an object that holds and maintains cookies across HTTP requests - * and responses. - * - * @param bool|Zend_Http_CookieJar $cookiejar Existing cookiejar object, true to create a new one, false to disable - * - * @return Zend_Http_Client - */ - public function setCookieJar($cookiejar = true) - { - Zend_Loader::loadClass(\Zend_Http_CookieJar::class); - - if ($cookiejar instanceof Zend_Http_CookieJar) { - $this->cookiejar = $cookiejar; - } elseif ($cookiejar === true) { - $this->cookiejar = new Zend_Http_CookieJar(); - } elseif (!$cookiejar) { - $this->cookiejar = null; - } else { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception('Invalid parameter type passed as CookieJar'); - } - - return $this; - } - - /** - * Return the current cookie jar or null if none. - * - * @return null|Zend_Http_CookieJar - */ - public function getCookieJar() - { - return $this->cookiejar; - } - - /** - * Add a cookie to the request. If the client has no Cookie Jar, the cookies - * will be added directly to the headers array as "Cookie" headers. - * - * @param string|Zend_Http_Cookie $cookie - * @param null|string $value if "cookie" is a string, this is the cookie value - * - * @return Zend_Http_Client - */ - public function setCookie($cookie, $value = null) - { - Zend_Loader::loadClass(\Zend_Http_Cookie::class); - - if (is_array($cookie)) { - foreach ($cookie as $c => $v) { - if (is_string($c)) { - $this->setCookie($c, $v); - } else { - $this->setCookie($v); - } - } - - return $this; - } - - if ($value !== null && $this->config['encodecookies']) { - $value = urlencode($value); - } - - if (isset($this->cookiejar)) { - if ($cookie instanceof Zend_Http_Cookie) { - $this->cookiejar->addCookie($cookie); - } elseif (is_string($cookie) && $value !== null) { - $cookie = Zend_Http_Cookie::fromString("{$cookie}={$value}", - $this->uri, - $this->config['encodecookies']); - $this->cookiejar->addCookie($cookie); - } - } else { - if ($cookie instanceof Zend_Http_Cookie) { - $name = $cookie->getName(); - $value = $cookie->getValue(); - $cookie = $name; - } - - if (preg_match("/[=,; \t\r\n\013\014]/", $cookie)) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("Cookie name cannot contain these characters: =,; \t\r\n\013\014 ({$cookie})"); - } - - $value = addslashes($value); - - if (!isset($this->headers['cookie'])) { - $this->headers['cookie'] = ['Cookie', '']; - } - $this->headers['cookie'][1] .= $cookie . '=' . $value . '; '; - } - - return $this; - } - - /** - * Set a file to upload (using a POST request). - * - * Can be used in two ways: - * - * 1. $data is null (default): $filename is treated as the name if a local file which - * will be read and sent. Will try to guess the content type using mime_content_type(). - * 2. $data is set - $filename is sent as the file name, but $data is sent as the file - * contents and no file is read from the file system. In this case, you need to - * manually set the Content-Type ($ctype) or it will default to - * application/octet-stream. - * - * @param string $filename Name of file to upload, or name to save as - * @param string $formname Name of form element to send as - * @param string $data Data to send (if null, $filename is read and sent) - * @param string $ctype Content type to use (if $data is set and $ctype is - * null, will be application/octet-stream) - * - * @return Zend_Http_Client - */ - public function setFileUpload($filename, $formname, $data = null, $ctype = null) - { - if ($data === null) { - if (($data = @file_get_contents($filename)) === false) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("Unable to read file '{$filename}' for upload"); - } - - if (!$ctype) { - $ctype = $this->_detectFileMimeType($filename); - } - } - - // Force enctype to multipart/form-data - $this->setEncType(self::ENC_FORMDATA); - - $this->files[] = [ - 'formname' => $formname, - 'filename' => basename($filename), - 'ctype' => $ctype, - 'data' => $data, - ]; - - $this->body_field_order[$formname] = self::VTYPE_FILE; - - return $this; - } - - /** - * Set the encoding type for POST data. - * - * @param string $enctype - * - * @return Zend_Http_Client - */ - public function setEncType($enctype = self::ENC_URLENCODED) - { - $this->enctype = $enctype; - - return $this; - } - - /** - * Set the raw (already encoded) POST data. - * - * This function is here for two reasons: - * 1. For advanced user who would like to set their own data, already encoded - * 2. For backwards compatibilty: If someone uses the old post($data) method. - * this method will be used to set the encoded data. - * - * $data can also be stream (such as file) from which the data will be read. - * - * @param resource|string $data - * @param string $enctype - * - * @return Zend_Http_Client - */ - public function setRawData($data, $enctype = null) - { - $this->raw_post_data = $data; - $this->setEncType($enctype); - if (is_resource($data)) { - // We've got stream data - $stat = @fstat($data); - if ($stat) { - $this->setHeaders(self::CONTENT_LENGTH, $stat['size']); - } - } - - return $this; - } - - /** - * Set the unmask feature for GET parameters as array. - * - * Example: - * foo%5B0%5D=a&foo%5B1%5D=b - * becomes - * foo=a&foo=b - * - * This is usefull for some services - * - * @param bool $status - * - * @return Zend_Http_Client - */ - public function setUnmaskStatus($status = true) - { - $this->_unmaskStatus = (BOOL) $status; - - return $this; - } - - /** - * Returns the currently configured unmask status. - * - * @return bool - */ - public function getUnmaskStatus() - { - return $this->_unmaskStatus; - } - - /** - * Clear all GET and POST parameters. - * - * Should be used to reset the request parameters if the client is - * used for several concurrent requests. - * - * clearAll parameter controls if we clean just parameters or also - * headers and last_* - * - * @param bool $clearAll Should all data be cleared? - * - * @return Zend_Http_Client - */ - public function resetParameters($clearAll = false) - { - // Reset parameter data - $this->paramsGet = []; - $this->paramsPost = []; - $this->files = []; - $this->raw_post_data = null; - $this->enctype = null; - - if ($clearAll) { - $this->headers = []; - $this->last_request = null; - $this->last_response = null; - } else { - // Clear outdated headers - if (isset($this->headers[strtolower(self::CONTENT_TYPE)])) { - unset($this->headers[strtolower(self::CONTENT_TYPE)]); - } - if (isset($this->headers[strtolower(self::CONTENT_LENGTH)])) { - unset($this->headers[strtolower(self::CONTENT_LENGTH)]); - } - } - - return $this; - } - - /** - * Get the last HTTP request as string. - * - * @return string - */ - public function getLastRequest() - { - return $this->last_request; - } - - /** - * Get the last HTTP response received by this client. - * - * If $config['storeresponse'] is set to false, or no response was - * stored yet, will return null - * - * @return Zend_Http_Response or null if none - */ - public function getLastResponse() - { - return $this->last_response; - } - - /** - * Load the connection adapter. - * - * While this method is not called more than one for a client, it is - * seperated from ->request() to preserve logic and readability - * - * @param string|Zend_Http_Client_Adapter_Interface $adapter - */ - public function setAdapter($adapter) - { - if (is_string($adapter)) { - try { - Zend_Loader::loadClass($adapter); - } catch (Zend_Exception $e) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}", 0, $e); - } - - $adapter = new $adapter(); - } - - if (!$adapter instanceof Zend_Http_Client_Adapter_Interface) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception('Passed adapter is not a HTTP connection adapter'); - } - - $this->adapter = $adapter; - $config = $this->config; - unset($config['adapter']); - $this->adapter->setConfig($config); - } - - /** - * Load the connection adapter. - * - * @return Zend_Http_Client_Adapter_Interface $adapter - */ - public function getAdapter() - { - if (null === $this->adapter) { - $this->setAdapter($this->config['adapter']); - } - - return $this->adapter; - } - - /** - * Set streaming for received data. - * - * @param bool|string $streamfile Stream file, true for temp file, false/null for no streaming - * - * @return Zend_Http_Client - */ - public function setStream($streamfile = true) - { - $this->setConfig(['output_stream' => $streamfile]); - - return $this; - } - - /** - * Get status of streaming for received data. - * - * @return bool|string - */ - public function getStream() - { - return $this->config['output_stream']; - } - - /** - * Create temporary stream. - * - * @return resource - */ - protected function _openTempStream() - { - $this->_stream_name = $this->config['output_stream']; - if (!is_string($this->_stream_name)) { - // If name is not given, create temp name - $this->_stream_name = tempnam($this->config['stream_tmp_dir'] ?? sys_get_temp_dir(), - \Zend_Http_Client::class); - } - - if (false === ($fp = @fopen($this->_stream_name, 'w+b'))) { - if ($this->adapter instanceof Zend_Http_Client_Adapter_Interface) { - $this->adapter->close(); - } - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("Could not open temp file {$this->_stream_name}"); - } - - return $fp; - } - - /** - * Send the HTTP request and return an HTTP response object. - * - * @param string $method - * - * @return Zend_Http_Response - */ - public function request($method = null) - { - $stream = null; - if (!$this->uri instanceof Zend_Uri_Http) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception('No valid URI has been passed to the client'); - } - - if ($method) { - $this->setMethod($method); - } - $this->redirectCounter = 0; - $response = null; - - // Make sure the adapter is loaded - if ($this->adapter == null) { - $this->setAdapter($this->config['adapter']); - } - - // Send the first request. If redirected, continue. - do { - // Clone the URI and add the additional GET parameters to it - $uri = clone $this->uri; - if (!empty($this->paramsGet)) { - $query = $uri->getQuery(); - if (!empty($query)) { - $query .= '&'; - } - $query .= http_build_query($this->paramsGet, '', '&'); - if ($this->config['rfc3986_strict']) { - $query = str_replace('+', '%20', $query); - } - - // @see ZF-11671 to unmask for some services to foo=val1&foo=val2 - if ($this->getUnmaskStatus()) { - if ($this->_queryBracketsEscaped) { - $query = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $query); - } else { - $query = preg_replace('/\\[(?:[0-9]|[1-9][0-9]+)\\]=/', '=', $query); - } - } - - $uri->setQuery($query); - } - - $body = $this->_prepareBody(); - $headers = $this->_prepareHeaders(); - - // check that adapter supports streaming before using it - if (is_resource($body) && !($this->adapter instanceof Zend_Http_Client_Adapter_Stream)) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception('Adapter does not support streaming'); - } - - // Open the connection, send the request and read the response - $this->adapter->connect($uri->getHost(), $uri->getPort(), - ($uri->getScheme() == 'https' ? true : false)); - - if ($this->config['output_stream']) { - if ($this->adapter instanceof Zend_Http_Client_Adapter_Stream) { - $stream = $this->_openTempStream(); - $this->adapter->setOutputStream($stream); - } else { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception('Adapter does not support streaming'); - } - } - - $this->last_request = $this->adapter->write($this->method, - $uri, $this->config['httpversion'], $headers, $body); - - $response = $this->adapter->read(); - if (!$response) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception('Unable to read response, or response is empty'); - } - - if ($this->config['output_stream']) { - $streamMetaData = stream_get_meta_data($stream); - if ($streamMetaData['seekable']) { - rewind($stream); - } - // cleanup the adapter - $this->adapter->setOutputStream(null); - $response = Zend_Http_Response_Stream::fromStream($response, $stream); - $response->setStreamName($this->_stream_name); - if (!is_string($this->config['output_stream'])) { - // we used temp name, will need to clean up - $response->setCleanup(true); - } - } else { - $response = Zend_Http_Response::fromString($response); - } - - if ($this->config['storeresponse']) { - $this->last_response = $response; - } - - // Load cookies into cookie jar - if (isset($this->cookiejar)) { - $this->cookiejar->addCookiesFromResponse($response, $uri, $this->config['encodecookies']); - } - - // If we got redirected, look for the Location header - if ($response->isRedirect() && ($location = $response->getHeader('location'))) { - // Avoid problems with buggy servers that add whitespace at the - // end of some headers (See ZF-11283) - $location = trim($location); - - // Check whether we send the exact same request again, or drop the parameters - // and send a GET request - if ($response->getStatus() == 303 - || ((!$this->config['strictredirects']) && ($response->getStatus() == 302 - || $response->getStatus() == 301))) { - $this->resetParameters(); - $this->setMethod(self::GET); - } - - // If we got a well formed absolute URI - if (($scheme = substr($location, 0, 6)) && ($scheme == 'http:/' || $scheme == 'https:')) { - $this->setHeaders('host', null); - $this->setUri($location); - } else { - // Split into path and query and set the query - if (strpos($location, '?') !== false) { - [$location, $query] = explode('?', $location, 2); - } else { - $query = ''; - } - $this->uri->setQuery($query); - - // Else, if we got just an absolute path, set it - if (strpos($location, '/') === 0) { - $this->uri->setPath($location); - - // Else, assume we have a relative path - } else { - // Get the current path directory, removing any trailing slashes - $path = $this->uri->getPath(); - $path = rtrim(substr($path, 0, strrpos($path, '/')), '/'); - $this->uri->setPath($path . '/' . $location); - } - } - ++$this->redirectCounter; - } else { - // If we didn't get any location, stop redirecting - break; - } - } while ($this->redirectCounter < $this->config['maxredirects']); - - return $response; - } - - /** - * Prepare the request headers. - * - * @return array - */ - protected function _prepareHeaders() - { - $headers = []; - - // Set the host header - if (!isset($this->headers['host'])) { - $host = $this->uri->getHost(); - - // If the port is not default, add it - if (!(($this->uri->getScheme() == 'http' && $this->uri->getPort() == 80) - || ($this->uri->getScheme() == 'https' && $this->uri->getPort() == 443))) { - $host .= ':' . $this->uri->getPort(); - } - - $headers[] = "Host: {$host}"; - } - - // Set the connection header - if (!isset($this->headers['connection'])) { - if (!$this->config['keepalive']) { - $headers[] = 'Connection: close'; - } - } - - // Set the Accept-encoding header if not set - depending on whether - // zlib is available or not. - if (!isset($this->headers['accept-encoding'])) { - if (function_exists('gzinflate')) { - $headers[] = 'Accept-encoding: gzip, deflate'; - } else { - $headers[] = 'Accept-encoding: identity'; - } - } - - // Set the Content-Type header - if (($this->method == self::POST || $this->method == self::PUT) - && (!isset($this->headers[strtolower(self::CONTENT_TYPE)]) && isset($this->enctype))) { - $headers[] = self::CONTENT_TYPE . ': ' . $this->enctype; - } - - // Set the user agent header - if (!isset($this->headers['user-agent']) && isset($this->config['useragent'])) { - $headers[] = "User-Agent: {$this->config['useragent']}"; - } - - // Set HTTP authentication if needed - if (is_array($this->auth)) { - $auth = self::encodeAuthHeader($this->auth['user'], $this->auth['password'], $this->auth['type']); - $headers[] = "Authorization: {$auth}"; - } - - // Load cookies from cookie jar - if (isset($this->cookiejar)) { - $cookstr = $this->cookiejar->getMatchingCookies($this->uri, - true, Zend_Http_CookieJar::COOKIE_STRING_CONCAT); - - if ($cookstr) { - $headers[] = "Cookie: {$cookstr}"; - } - } - - // Add all other user defined headers - foreach ($this->headers as $header) { - [$name, $value] = $header; - if (is_array($value)) { - $value = implode(', ', $value); - } - - $headers[] = "$name: $value"; - } - - return $headers; - } - - /** - * Prepare the request body (for POST and PUT requests). - * - * @return string - */ - protected function _prepareBody() - { - // According to RFC2616, a TRACE request should not have a body. - if ($this->method == self::TRACE) { - return ''; - } - - if (isset($this->raw_post_data) && is_resource($this->raw_post_data)) { - return $this->raw_post_data; - } - // If mbstring overloads substr and strlen functions, we have to - // override it's internal encoding - if (function_exists('mb_internal_encoding') - && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbIntEnc = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } - - // If we have raw_post_data set, just use it as the body. - if (isset($this->raw_post_data)) { - $this->setHeaders(self::CONTENT_LENGTH, strlen($this->raw_post_data)); - if (isset($mbIntEnc)) { - mb_internal_encoding($mbIntEnc); - } - - return $this->raw_post_data; - } - - $body = ''; - - // If we have files to upload, force enctype to multipart/form-data - if (count($this->files) > 0) { - $this->setEncType(self::ENC_FORMDATA); - } - - // If we have POST parameters or files, encode and add them to the body - if (count($this->paramsPost) > 0 || count($this->files) > 0) { - switch ($this->enctype) { - case self::ENC_FORMDATA: - // Encode body as multipart/form-data - $boundary = '---ZENDHTTPCLIENT-' . md5(microtime()); - $this->setHeaders(self::CONTENT_TYPE, self::ENC_FORMDATA . "; boundary={$boundary}"); - - // Encode all files and POST vars in the order they were given - foreach ($this->body_field_order as $fieldName => $fieldType) { - switch ($fieldType) { - case self::VTYPE_FILE: - foreach ($this->files as $file) { - if ($file['formname'] === $fieldName) { - $fhead = [self::CONTENT_TYPE => $file['ctype']]; - $body .= self::encodeFormData($boundary, $file['formname'], $file['data'], $file['filename'], $fhead); - } - } - - break; - case self::VTYPE_SCALAR: - if (isset($this->paramsPost[$fieldName])) { - if (is_array($this->paramsPost[$fieldName])) { - $flattened = self::_flattenParametersArray($this->paramsPost[$fieldName], $fieldName); - foreach ($flattened as $pp) { - $body .= self::encodeFormData($boundary, $pp[0], $pp[1]); - } - } else { - $body .= self::encodeFormData($boundary, $fieldName, $this->paramsPost[$fieldName]); - } - } - - break; - } - } - - $body .= "--{$boundary}--\r\n"; - - break; - - case self::ENC_URLENCODED: - // Encode body as application/x-www-form-urlencoded - $this->setHeaders(self::CONTENT_TYPE, self::ENC_URLENCODED); - $body = http_build_query($this->paramsPost, '', '&'); - - break; - - default: - if (isset($mbIntEnc)) { - mb_internal_encoding($mbIntEnc); - } - - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("Cannot handle content type '{$this->enctype}' automatically." - . ' Please use Zend_Http_Client::setRawData to send this kind of content.'); - - break; - } - } - - // Set the Content-Length if we have a body or if request is POST/PUT - if ($body || $this->method == self::POST || $this->method == self::PUT) { - $this->setHeaders(self::CONTENT_LENGTH, strlen($body)); - } - - if (isset($mbIntEnc)) { - mb_internal_encoding($mbIntEnc); - } - - return $body; - } - - /** - * Helper method that gets a possibly multi-level parameters array (get or - * post) and flattens it. - * - * The method returns an array of (key, value) pairs (because keys are not - * necessarily unique. If one of the parameters in as array, it will also - * add a [] suffix to the key. - * - * This method is deprecated since Zend Framework 1.9 in favour of - * self::_flattenParametersArray() and will be dropped in 2.0 - * - * @deprecated since 1.9 - * - * @param array $parray The parameters array - * @param bool $urlencode Whether to urlencode the name and value - * - * @return array - */ - protected function _getParametersRecursive($parray, $urlencode = false) - { - // Issue a deprecated notice - trigger_error('The ' . __METHOD__ . ' method is deprecated and will be dropped in 2.0.', - E_USER_NOTICE); - - if (!is_array($parray)) { - return $parray; - } - $parameters = []; - - foreach ($parray as $name => $value) { - if ($urlencode) { - $name = urlencode($name); - } - - // If $value is an array, iterate over it - if (is_array($value)) { - $name .= ($urlencode ? '%5B%5D' : '[]'); - foreach ($value as $subval) { - if ($urlencode) { - $subval = urlencode($subval); - } - $parameters[] = [$name, $subval]; - } - } else { - if ($urlencode) { - $value = urlencode($value); - } - $parameters[] = [$name, $value]; - } - } - - return $parameters; - } - - /** - * Attempt to detect the MIME type of a file using available extensions. - * - * This method will try to detect the MIME type of a file. If the fileinfo - * extension is available, it will be used. If not, the mime_magic - * extension which is deprected but is still available in many PHP setups - * will be tried. - * - * If neither extension is available, the default application/octet-stream - * MIME type will be returned - * - * @param string $file File path - * - * @return string MIME type - */ - protected function _detectFileMimeType($file) - { - $type = null; - - // First try with fileinfo functions - if (function_exists('finfo_open')) { - if (self::$_fileInfoDb === null) { - self::$_fileInfoDb = @finfo_open(FILEINFO_MIME); - } - - if (self::$_fileInfoDb) { - $type = finfo_file(self::$_fileInfoDb, $file); - } - } elseif (function_exists('mime_content_type')) { - $type = mime_content_type($file); - } - - // Fallback to the default application/octet-stream - if (!$type) { - $type = 'application/octet-stream'; - } - - return $type; - } - - /** - * Encode data to a multipart/form-data part suitable for a POST request. - * - * @param string $boundary - * @param string $name - * @param mixed $value - * @param string $filename - * @param array $headers Associative array of optional headers @example ("Content-Transfer-Encoding" => "binary") - * - * @return string - */ - public static function encodeFormData($boundary, $name, $value, $filename = null, $headers = []) - { - $ret = "--{$boundary}\r\n" - . 'Content-Disposition: form-data; name="' . $name . '"'; - - if ($filename) { - $ret .= '; filename="' . $filename . '"'; - } - $ret .= "\r\n"; - - foreach ($headers as $hname => $hvalue) { - $ret .= "{$hname}: {$hvalue}\r\n"; - } - $ret .= "\r\n"; - - $ret .= "{$value}\r\n"; - - return $ret; - } - - /** - * Create a HTTP authentication "Authorization:" header according to the - * specified user, password and authentication method. - * - * @see http://www.faqs.org/rfcs/rfc2617.html - * - * @param string $user - * @param string $password - * @param string $type - * - * @return string - */ - public static function encodeAuthHeader($user, $password, $type = self::AUTH_BASIC) - { - $authHeader = null; - - switch ($type) { - case self::AUTH_BASIC: - // In basic authentication, the user name cannot contain ":" - if (strpos($user, ':') !== false) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("The user name cannot contain ':' in 'Basic' HTTP authentication"); - } - - $authHeader = 'Basic ' . base64_encode($user . ':' . $password); - - break; - - //case self::AUTH_DIGEST: - // @todo Implement digest authentication - // break; - - default: - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception("Not a supported HTTP authentication type: '$type'"); - } - - return $authHeader; - } - - /** - * Convert an array of parameters into a flat array of (key, value) pairs. - * - * Will flatten a potentially multi-dimentional array of parameters (such - * as POST parameters) into a flat array of (key, value) paris. In case - * of multi-dimentional arrays, square brackets ([]) will be added to the - * key to indicate an array. - * - * @since 1.9 - * - * @param array $parray - * @param string $prefix - * - * @return array - */ - protected static function _flattenParametersArray($parray, $prefix = null) - { - if (!is_array($parray)) { - return $parray; - } - - $parameters = []; - - foreach ($parray as $name => $value) { - // Calculate array key - if ($prefix) { - if (is_int($name)) { - $key = $prefix . '[]'; - } else { - $key = $prefix . "[$name]"; - } - } else { - $key = $name; - } - - if (is_array($value)) { - $parameters = array_merge($parameters, self::_flattenParametersArray($value, $key)); - } else { - $parameters[] = [$key, $value]; - } - } - - return $parameters; - } - - /** - * Ensure a header value is valid per RFC 7230. - * - * @see http://tools.ietf.org/html/rfc7230#section-3.2 - * - * @param array|object|string $value - * @param bool $recurse - */ - protected function _validateHeaderValue($value, $recurse = true) - { - if (is_array($value) && $recurse) { - foreach ($value as $v) { - $this->_validateHeaderValue($v, false); - } - - return; - } - - // Cast integers and floats to strings for purposes of header representation. - if (is_int($value) || is_float($value)) { - $value = (string) $value; - } - - if (!is_string($value) && (!is_object($value) || !method_exists($value, '__toString'))) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('Invalid header value detected'); - } - - Zend_Http_Header_HeaderValue::assertValid($value); - } -} diff --git a/library/Zend/Http/Client/Adapter/Curl.php b/library/Zend/Http/Client/Adapter/Curl.php deleted file mode 100644 index 8f99c8775..000000000 --- a/library/Zend/Http/Client/Adapter/Curl.php +++ /dev/null @@ -1,552 +0,0 @@ -_invalidOverwritableCurlOptions = [ - CURLOPT_HTTPGET, - CURLOPT_POST, - CURLOPT_PUT, - CURLOPT_CUSTOMREQUEST, - CURLOPT_HEADER, - CURLOPT_RETURNTRANSFER, - CURLOPT_HTTPHEADER, - CURLOPT_POSTFIELDS, - CURLOPT_INFILE, - CURLOPT_INFILESIZE, - CURLOPT_PORT, - CURLOPT_MAXREDIRS, - CURLOPT_CONNECTTIMEOUT, - CURL_HTTP_VERSION_1_1, - CURL_HTTP_VERSION_1_0, - ]; - } - - /** - * Set the configuration array for the adapter. - * - * @param array|Zend_Config $config - * - * @return Zend_Http_Client_Adapter_Curl - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Array or Zend_Config object expected, got ' . gettype($config) - ); - } - - if (isset($config['proxy_user'], $config['proxy_pass'])) { - $this->setCurlOption(CURLOPT_PROXYUSERPWD, $config['proxy_user'] . ':' . $config['proxy_pass']); - unset($config['proxy_user'], $config['proxy_pass']); - } - - foreach ($config as $k => $v) { - $option = strtolower($k); - switch ($option) { - case 'proxy_host': - $this->setCurlOption(CURLOPT_PROXY, $v); - - break; - case 'proxy_port': - $this->setCurlOption(CURLOPT_PROXYPORT, $v); - - break; - default: - $this->_config[$option] = $v; - - break; - } - } - - return $this; - } - - /** - * Retrieve the array of all configuration options. - * - * @return array - */ - public function getConfig() - { - return $this->_config; - } - - /** - * Direct setter for cURL adapter related options. - * - * @param int|string $option - * @param mixed $value - * - * @return Zend_Http_Adapter_Curl - */ - public function setCurlOption($option, $value) - { - if (!isset($this->_config['curloptions'])) { - $this->_config['curloptions'] = []; - } - $this->_config['curloptions'][$option] = $value; - - return $this; - } - - /** - * Initialize curl. - * - * @param string $host - * @param int $port - * @param bool $secure - */ - public function connect($host, $port = 80, $secure = false) - { - // If we're already connected, disconnect first - if ($this->_curl) { - $this->close(); - } - - // If we are connected to a different server or port, disconnect first - if ($this->_curl - && is_array($this->_connected_to) - && ($this->_connected_to[0] != $host - || $this->_connected_to[1] != $port) - ) { - $this->close(); - } - - // Do the actual connection - $this->_curl = curl_init(); - if ($port != 80) { - curl_setopt($this->_curl, CURLOPT_PORT, intval($port)); - } - - // Set connection timeout - $connectTimeout = $this->_config['timeout']; - $constant = CURLOPT_CONNECTTIMEOUT; - if (defined('CURLOPT_CONNECTTIMEOUT_MS')) { - $connectTimeout *= 1000; - $constant = constant('CURLOPT_CONNECTTIMEOUT_MS'); - } - curl_setopt($this->_curl, $constant, $connectTimeout); - - // Set request timeout (once connection is established) - if (array_key_exists('request_timeout', $this->_config)) { - $requestTimeout = $this->_config['request_timeout']; - $constant = CURLOPT_TIMEOUT; - if (defined('CURLOPT_TIMEOUT_MS')) { - $requestTimeout *= 1000; - $constant = constant('CURLOPT_TIMEOUT_MS'); - } - curl_setopt($this->_curl, $constant, $requestTimeout); - } - - // Set Max redirects - curl_setopt($this->_curl, CURLOPT_MAXREDIRS, $this->_config['maxredirects']); - - if (!$this->_curl) { - $this->close(); - - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Unable to Connect to ' . $host . ':' . $port); - } - - if ($secure !== false) { - // Behave the same like Zend_Http_Adapter_Socket on SSL options. - if (isset($this->_config['sslcert'])) { - curl_setopt($this->_curl, CURLOPT_SSLCERT, $this->_config['sslcert']); - } - if (isset($this->_config['sslpassphrase'])) { - curl_setopt($this->_curl, CURLOPT_SSLCERTPASSWD, $this->_config['sslpassphrase']); - } - } - - // Update connected_to - $this->_connected_to = [$host, $port]; - } - - /** - * Send request to the remote server. - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param array $headers - * @param string $body - * @param mixed $httpVersion - * - * @return string $request - */ - public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = '') - { - // Make sure we're properly connected - if (!$this->_curl) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected'); - } - - if ($this->_connected_to[0] != $uri->getHost() || $this->_connected_to[1] != $uri->getPort()) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong host'); - } - - // set URL - curl_setopt($this->_curl, CURLOPT_URL, $uri->__toString()); - - // ensure correct curl call - $curlValue = true; - switch ($method) { - case Zend_Http_Client::GET: - $curlMethod = CURLOPT_HTTPGET; - - break; - - case Zend_Http_Client::POST: - $curlMethod = CURLOPT_POST; - - break; - - case Zend_Http_Client::PUT: - // There are two different types of PUT request, either a Raw Data string has been set - // or CURLOPT_INFILE and CURLOPT_INFILESIZE are used. - if (is_resource($body)) { - $this->_config['curloptions'][CURLOPT_INFILE] = $body; - } - if (isset($this->_config['curloptions'][CURLOPT_INFILE])) { - // Now we will probably already have Content-Length set, so that we have to delete it - // from $headers at this point: - foreach ($headers as $k => $header) { - if (preg_match('/Content-Length:\s*(\d+)/i', $header, $m)) { - if (is_resource($body)) { - $this->_config['curloptions'][CURLOPT_INFILESIZE] = (int) $m[1]; - } - unset($headers[$k]); - } - } - - if (!isset($this->_config['curloptions'][CURLOPT_INFILESIZE])) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Cannot set a file-handle for cURL option CURLOPT_INFILE without also setting its size in CURLOPT_INFILESIZE.'); - } - - if (is_resource($body)) { - $body = ''; - } - - $curlMethod = CURLOPT_PUT; - } else { - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'PUT'; - } - - break; - - case Zend_Http_Client::PATCH: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'PATCH'; - - break; - - case Zend_Http_Client::DELETE: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'DELETE'; - - break; - - case Zend_Http_Client::OPTIONS: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'OPTIONS'; - - break; - - case Zend_Http_Client::TRACE: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'TRACE'; - - break; - - case Zend_Http_Client::HEAD: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'HEAD'; - - break; - - default: - // For now, through an exception for unsupported request methods - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Method currently not supported'); - } - - if (is_resource($body) && $curlMethod != CURLOPT_PUT) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Streaming requests are allowed only with PUT'); - } - - // get http version to use - $curlHttp = ($httpVersion == 1.1) ? CURL_HTTP_VERSION_1_1 : CURL_HTTP_VERSION_1_0; - - // mark as HTTP request and set HTTP method - curl_setopt($this->_curl, CURLOPT_HTTP_VERSION, $curlHttp); - curl_setopt($this->_curl, $curlMethod, $curlValue); - - if ($this->out_stream) { - // headers will be read into the response - curl_setopt($this->_curl, CURLOPT_HEADER, false); - curl_setopt($this->_curl, CURLOPT_HEADERFUNCTION, [$this, 'readHeader']); - // and data will be written into the file - curl_setopt($this->_curl, CURLOPT_FILE, $this->out_stream); - } else { - // ensure headers are also returned - curl_setopt($this->_curl, CURLOPT_HEADER, true); - curl_setopt($this->_curl, CURLINFO_HEADER_OUT, true); - - // ensure actual response is returned - curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, true); - } - - // set additional headers - $headers['Accept'] = ''; - curl_setopt($this->_curl, CURLOPT_HTTPHEADER, $headers); - - /* - * Make sure POSTFIELDS is set after $curlMethod is set: - * @link http://de2.php.net/manual/en/function.curl-setopt.php#81161 - */ - if ($method == Zend_Http_Client::POST) { - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } elseif ($curlMethod == CURLOPT_PUT) { - // this covers a PUT by file-handle: - // Make the setting of this options explicit (rather than setting it through the loop following a bit lower) - // to group common functionality together. - curl_setopt($this->_curl, CURLOPT_INFILE, $this->_config['curloptions'][CURLOPT_INFILE]); - curl_setopt($this->_curl, CURLOPT_INFILESIZE, $this->_config['curloptions'][CURLOPT_INFILESIZE]); - unset($this->_config['curloptions'][CURLOPT_INFILE], $this->_config['curloptions'][CURLOPT_INFILESIZE]); - } elseif ($method == Zend_Http_Client::PUT) { - // This is a PUT by a setRawData string, not by file-handle - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } elseif ($method == Zend_Http_Client::PATCH) { - // This is a PATCH by a setRawData string - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } elseif ($method == Zend_Http_Client::DELETE) { - // This is a DELETE by a setRawData string - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } elseif ($method == Zend_Http_Client::OPTIONS) { - // This is an OPTIONS by a setRawData string - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } - - // set additional curl options - if (isset($this->_config['curloptions'])) { - foreach ((array) $this->_config['curloptions'] as $k => $v) { - if (!in_array($k, $this->_invalidOverwritableCurlOptions)) { - if (curl_setopt($this->_curl, $k, $v) == false) { - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception(sprintf("Unknown or erroreous cURL option '%s' set", $k)); - } - } - } - } - - // send the request - $response = curl_exec($this->_curl); - - // if we used streaming, headers are already there - if (!is_resource($this->out_stream)) { - $this->_response = $response; - } - - $request = curl_getinfo($this->_curl, CURLINFO_HEADER_OUT); - $request .= $body; - - if (empty($this->_response)) { - require_once 'Zend/Http/Client/Exception.php'; - - throw new Zend_Http_Client_Exception('Error in cURL request: ' . curl_error($this->_curl)); - } - - // cURL automatically decodes chunked-messages, this means we have to disallow the Zend_Http_Response to do it again - if (stripos($this->_response, "Transfer-Encoding: chunked\r\n")) { - $this->_response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $this->_response); - } - - // Eliminate multiple HTTP responses. - do { - $parts = preg_split('|(?:\r?\n){2}|m', $this->_response, 2); - $again = false; - - if (isset($parts[1]) && preg_match("|^HTTP/1\.[01](.*?)\r\n|mi", $parts[1])) { - $this->_response = $parts[1]; - $again = true; - } - } while ($again); - - // cURL automatically handles Proxy rewrites, remove the "HTTP/1.0 200 Connection established" string: - if (stripos($this->_response, "HTTP/1.0 200 Connection established\r\n\r\n") !== false) { - $this->_response = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $this->_response); - } - - return $request; - } - - /** - * Return read response from server. - * - * @return string - */ - public function read() - { - return $this->_response; - } - - /** - * Close the connection to the server. - */ - public function close() - { - if (is_resource($this->_curl)) { - curl_close($this->_curl); - } - $this->_curl = null; - $this->_connected_to = [null, null]; - } - - /** - * Get cUrl Handle. - * - * @return resource - */ - public function getHandle() - { - return $this->_curl; - } - - /** - * Set output stream for the response. - * - * @param resource $stream - * - * @return Zend_Http_Client_Adapter_Socket - */ - public function setOutputStream($stream) - { - $this->out_stream = $stream; - - return $this; - } - - /** - * Header reader function for CURL. - * - * @param resource $curl - * @param string $header - * - * @return int - */ - public function readHeader($curl, $header) - { - $this->_response .= $header; - - return strlen($header); - } -} diff --git a/library/Zend/Http/Client/Adapter/Exception.php b/library/Zend/Http/Client/Adapter/Exception.php deleted file mode 100644 index 1250d0534..000000000 --- a/library/Zend/Http/Client/Adapter/Exception.php +++ /dev/null @@ -1,32 +0,0 @@ - 'ssl', - 'sslcert' => null, - 'sslpassphrase' => null, - 'sslusecontext' => false, - 'proxy_host' => '', - 'proxy_port' => 8080, - 'proxy_user' => '', - 'proxy_pass' => '', - 'proxy_auth' => Zend_Http_Client::AUTH_BASIC, - 'persistent' => false, - ]; - - /** - * Whether HTTPS CONNECT was already negotiated with the proxy or not. - * - * @var bool - */ - protected $negotiated = false; - - /** - * Stores the last CONNECT handshake request. - * - * @var string - */ - protected $connectHandshakeRequest; - - /** - * Connect to the remote server. - * - * Will try to connect to the proxy server. If no proxy was set, will - * fall back to the target server (behave like regular Socket adapter) - * - * @param string $host - * @param int $port - * @param bool $secure - */ - public function connect($host, $port = 80, $secure = false) - { - // If no proxy is set, fall back to Socket adapter - if (!$this->config['proxy_host']) { - return parent::connect($host, $port, $secure); - } - - // Url might require stream context even if proxy connection doesn't - if ($secure) { - $this->config['sslusecontext'] = true; - } - - // Connect (a non-secure connection) to the proxy server - return parent::connect( - $this->config['proxy_host'], - $this->config['proxy_port'], - false - ); - } - - /** - * Send request to the proxy server. - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param string $http_ver - * @param array $headers - * @param string $body - * - * @return string Request as string - */ - public function write( - $method, $uri, $http_ver = '1.1', $headers = [], $body = '' - ) { - // If no proxy is set, fall back to default Socket adapter - if (!$this->config['proxy_host']) { - return parent::write($method, $uri, $http_ver, $headers, $body); - } - - // Make sure we're properly connected - if (!$this->socket) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Trying to write but we are not connected' - ); - } - - $host = $this->config['proxy_host']; - $port = $this->config['proxy_port']; - - if ($this->connected_to[0] != "tcp://$host" - || $this->connected_to[1] != $port - ) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Trying to write but we are connected to the wrong proxy server' - ); - } - - // Add Proxy-Authorization header - if ($this->config['proxy_user']) { - // Check to see if one already exists - $hasProxyAuthHeader = false; - foreach ($headers as $k => $v) { - if ((string) $k == 'proxy-authorization' - || preg_match('/^proxy-authorization:/i', $v) - ) { - $hasProxyAuthHeader = true; - - break; - } - } - if (!$hasProxyAuthHeader) { - $headers[] = 'Proxy-authorization: ' - . Zend_Http_Client::encodeAuthHeader( - $this->config['proxy_user'], - $this->config['proxy_pass'], $this->config['proxy_auth'] - ); - } - } - - // if we are proxying HTTPS, preform CONNECT handshake with the proxy - if ($uri->getScheme() == 'https' && (!$this->negotiated)) { - $this->connectHandshake( - $uri->getHost(), $uri->getPort(), $http_ver, $headers - ); - $this->negotiated = true; - } - - // Save request method for later - $this->method = $method; - - // Build request headers - if ($this->negotiated) { - $path = $uri->getPath(); - if ($uri->getQuery()) { - $path .= '?' . $uri->getQuery(); - } - $request = "$method $path HTTP/$http_ver\r\n"; - } else { - $request = "$method $uri HTTP/$http_ver\r\n"; - } - - // Add all headers to the request string - foreach ($headers as $k => $v) { - if (is_string($k)) { - $v = "$k: $v"; - } - $request .= "$v\r\n"; - } - - if (is_resource($body)) { - $request .= "\r\n"; - } else { - // Add the request body - $request .= "\r\n" . $body; - } - - // Send the request - if (!@fwrite($this->socket, $request)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Error writing request to proxy server' - ); - } - - if (is_resource($body)) { - if (stream_copy_to_stream($body, $this->socket) == 0) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Error writing request to server' - ); - } - } - - return $request; - } - - /** - * Preform handshaking with HTTPS proxy using CONNECT method. - * - * @param string $host - * @param int $port - * @param string $http_ver - */ - protected function connectHandshake( - $host, $port = 443, $http_ver = '1.1', array &$headers = [] - ) { - $request = "CONNECT $host:$port HTTP/$http_ver\r\n" - . 'Host: ' . $host . "\r\n"; - - // Process provided headers, including important ones to CONNECT request - foreach ($headers as $k => $v) { - switch (strtolower(substr($v,0,strpos($v,':')))) { - case 'proxy-authorization': - // break intentionally omitted - - case 'user-agent': - $request .= $v . "\r\n"; - - break; - - default: - break; - } - } - $request .= "\r\n"; - - // @see ZF-3189 - $this->connectHandshakeRequest = $request; - - // Send the request - if (!@fwrite($this->socket, $request)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Error writing request to proxy server' - ); - } - - // Read response headers only - $response = ''; - $gotStatus = false; - while ($line = @fgets($this->socket)) { - $gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false); - if ($gotStatus) { - $response .= $line; - if (!chop($line)) { - break; - } - } - } - - // Check that the response from the proxy is 200 - if (Zend_Http_Response::extractCode($response) != 200) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Unable to connect to HTTPS proxy. Server response: ' . $response - ); - } - - // If all is good, switch socket to secure mode. We have to fall back - // through the different modes - $modes = [ - STREAM_CRYPTO_METHOD_TLS_CLIENT, - STREAM_CRYPTO_METHOD_SSLv3_CLIENT, - STREAM_CRYPTO_METHOD_SSLv23_CLIENT, - STREAM_CRYPTO_METHOD_SSLv2_CLIENT, - ]; - - $success = false; - foreach ($modes as $mode) { - $success = stream_socket_enable_crypto($this->socket, true, $mode); - if ($success) { - break; - } - } - - if (!$success) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Unable to connect to HTTPS server through proxy: could not ' - . 'negotiate secure connection.' - ); - } - } - - /** - * Close the connection to the server. - */ - public function close() - { - parent::close(); - $this->negotiated = false; - } - - /** - * Destructor: make sure the socket is disconnected. - */ - public function __destruct() - { - if ($this->socket) { - $this->close(); - } - } -} diff --git a/library/Zend/Http/Client/Adapter/Socket.php b/library/Zend/Http/Client/Adapter/Socket.php deleted file mode 100644 index daffa580a..000000000 --- a/library/Zend/Http/Client/Adapter/Socket.php +++ /dev/null @@ -1,565 +0,0 @@ - false, - 'ssltransport' => 'ssl', - 'sslcert' => null, - 'sslpassphrase' => null, - 'sslusecontext' => false, - ]; - - /** - * Request method - will be set by write() and might be used by read(). - * - * @var string - */ - protected $method; - - /** - * Stream context. - * - * @var resource - */ - protected $_context; - - /** - * Adapter constructor, currently empty. Config is set using setConfig(). - */ - public function __construct() - { - } - - /** - * Set the configuration array for the adapter. - * - * @param array|Zend_Config $config - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Array or Zend_Config object expected, got ' . gettype($config) - ); - } - - foreach ($config as $k => $v) { - $this->config[strtolower($k)] = $v; - } - } - - /** - * Retrieve the array of all configuration options. - * - * @return array - */ - public function getConfig() - { - return $this->config; - } - - /** - * Set the stream context for the TCP connection to the server. - * - * Can accept either a pre-existing stream context resource, or an array - * of stream options, similar to the options array passed to the - * stream_context_create() PHP function. In such case a new stream context - * will be created using the passed options. - * - * @since Zend Framework 1.9 - * - * @param mixed $context Stream context or array of context options - * - * @return Zend_Http_Client_Adapter_Socket - */ - public function setStreamContext($context) - { - if (is_resource($context) && get_resource_type($context) == 'stream-context') { - $this->_context = $context; - } elseif (is_array($context)) { - $this->_context = stream_context_create($context); - } else { - // Invalid parameter - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Expecting either a stream context resource or array, got ' . gettype($context) - ); - } - - return $this; - } - - /** - * Get the stream context for the TCP connection to the server. - * - * If no stream context is set, will create a default one. - * - * @return resource - */ - public function getStreamContext() - { - if (!$this->_context) { - $this->_context = stream_context_create(); - } - - return $this->_context; - } - - /** - * Connect to the remote server. - * - * @param string $host - * @param int $port - * @param bool $secure - */ - public function connect($host, $port = 80, $secure = false) - { - // If the URI should be accessed via SSL, prepend the Hostname with ssl:// - $host = ($secure ? $this->config['ssltransport'] : 'tcp') . '://' . $host; - - // If we are connected to the wrong host, disconnect first - if (($this->connected_to[0] != $host || $this->connected_to[1] != $port)) { - if (is_resource($this->socket)) { - $this->close(); - } - } - - // Now, if we are not connected, connect - if (!is_resource($this->socket) || !$this->config['keepalive']) { - $context = $this->getStreamContext(); - if ($secure || $this->config['sslusecontext']) { - if ($this->config['sslcert'] !== null) { - if (!stream_context_set_option($context, 'ssl', 'local_cert', - $this->config['sslcert'])) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Unable to set sslcert option'); - } - } - if ($this->config['sslpassphrase'] !== null) { - if (!stream_context_set_option($context, 'ssl', 'passphrase', - $this->config['sslpassphrase'])) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Unable to set sslpassphrase option'); - } - } - } - - $flags = STREAM_CLIENT_CONNECT; - if ($this->config['persistent']) { - $flags |= STREAM_CLIENT_PERSISTENT; - } - - $this->socket = @stream_socket_client($host . ':' . $port, - $errno, - $errstr, - (int) $this->config['timeout'], - $flags, - $context); - - if (!$this->socket) { - $this->close(); - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Unable to Connect to ' . $host . ':' . $port . '. Error #' . $errno . ': ' . $errstr); - } - - // Set the stream timeout - if (!stream_set_timeout($this->socket, (int) $this->config['timeout'])) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Unable to set the connection timeout'); - } - - // Update connected_to - $this->connected_to = [$host, $port]; - } - } - - /** - * Send request to the remote server. - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param string $http_ver - * @param array $headers - * @param string $body - * - * @return string Request as string - */ - public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') - { - // Make sure we're properly connected - if (!$this->socket) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected'); - } - - $host = $uri->getHost(); - $host = (strtolower($uri->getScheme()) == 'https' ? $this->config['ssltransport'] : 'tcp') . '://' . $host; - if ($this->connected_to[0] != $host || $this->connected_to[1] != $uri->getPort()) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong host'); - } - - // Save request method for later - $this->method = $method; - - // Build request headers - $path = $uri->getPath(); - if ($uri->getQuery()) { - $path .= '?' . $uri->getQuery(); - } - $request = "{$method} {$path} HTTP/{$http_ver}\r\n"; - foreach ($headers as $k => $v) { - if (is_string($k)) { - $v = ucfirst($k) . ": $v"; - } - $request .= "$v\r\n"; - } - - if (is_resource($body)) { - $request .= "\r\n"; - } else { - // Add the request body - $request .= "\r\n" . $body; - } - - // Send the request - if (!@fwrite($this->socket, $request)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Error writing request to server'); - } - - if (is_resource($body)) { - if (stream_copy_to_stream($body, $this->socket) == 0) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Error writing request to server'); - } - } - - return $request; - } - - /** - * Read response from server. - * - * @return string - */ - public function read() - { - // First, read headers only - $response = ''; - $gotStatus = false; - - while (($line = @fgets($this->socket)) !== false) { - $gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false); - if ($gotStatus) { - $response .= $line; - if (rtrim($line) === '') { - break; - } - } - } - - $this->_checkSocketReadTimeout(); - - $statusCode = Zend_Http_Response::extractCode($response); - - // Handle 100 and 101 responses internally by restarting the read again - if ($statusCode == 100 || $statusCode == 101) { - return $this->read(); - } - - // Check headers to see what kind of connection / transfer encoding we have - $headers = Zend_Http_Response::extractHeaders($response); - - /* - * Responses to HEAD requests and 204 or 304 responses are not expected - * to have a body - stop reading here - */ - if ($statusCode == 304 || $statusCode == 204 - || $this->method == Zend_Http_Client::HEAD) { - // Close the connection if requested to do so by the server - if (isset($headers['connection']) && $headers['connection'] == 'close') { - $this->close(); - } - - return $response; - } - - // If we got a 'transfer-encoding: chunked' header - if (isset($headers['transfer-encoding'])) { - if (strtolower($headers['transfer-encoding']) == 'chunked') { - do { - $line = @fgets($this->socket); - $this->_checkSocketReadTimeout(); - - $chunk = $line; - - // Figure out the next chunk size - $chunksize = trim($line); - if (!ctype_xdigit($chunksize)) { - $this->close(); - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Invalid chunk size "' - . $chunksize . '" unable to read chunked body'); - } - - // Convert the hexadecimal value to plain integer - $chunksize = hexdec($chunksize); - - // Read next chunk - $read_to = ftell($this->socket) + $chunksize; - - do { - $current_pos = ftell($this->socket); - if ($current_pos >= $read_to) { - break; - } - - if ($this->out_stream) { - if (stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) { - $this->_checkSocketReadTimeout(); - - break; - } - } else { - $line = @fread($this->socket, $read_to - $current_pos); - if ($line === false || strlen($line) === 0) { - $this->_checkSocketReadTimeout(); - - break; - } - $chunk .= $line; - } - } while (!feof($this->socket)); - - $chunk .= @fgets($this->socket); - $this->_checkSocketReadTimeout(); - - if (!$this->out_stream) { - $response .= $chunk; - } - } while ($chunksize > 0); - } else { - $this->close(); - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Cannot handle "' - . $headers['transfer-encoding'] . '" transfer encoding'); - } - - // We automatically decode chunked-messages when writing to a stream - // this means we have to disallow the Zend_Http_Response to do it again - if ($this->out_stream) { - $response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $response); - } - // Else, if we got the content-length header, read this number of bytes - } elseif (isset($headers['content-length'])) { - // If we got more than one Content-Length header (see ZF-9404) use - // the last value sent - if (is_array($headers['content-length'])) { - $contentLength = $headers['content-length'][count($headers['content-length']) - 1]; - } else { - $contentLength = $headers['content-length']; - } - - $current_pos = ftell($this->socket); - $chunk = ''; - - for ($read_to = $current_pos + $contentLength; - $read_to > $current_pos; - $current_pos = ftell($this->socket)) { - if ($this->out_stream) { - if (@stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) { - $this->_checkSocketReadTimeout(); - - break; - } - } else { - $chunk = @fread($this->socket, $read_to - $current_pos); - if ($chunk === false || strlen($chunk) === 0) { - $this->_checkSocketReadTimeout(); - - break; - } - - $response .= $chunk; - } - - // Break if the connection ended prematurely - if (feof($this->socket)) { - break; - } - } - - // Fallback: just read the response until EOF - } else { - do { - if ($this->out_stream) { - if (@stream_copy_to_stream($this->socket, $this->out_stream) == 0) { - $this->_checkSocketReadTimeout(); - - break; - } - } else { - $buff = @fread($this->socket, 8192); - if ($buff === false || strlen($buff) === 0) { - $this->_checkSocketReadTimeout(); - - break; - } - $response .= $buff; - } - } while (feof($this->socket) === false); - - $this->close(); - } - - // Close the connection if requested to do so by the server - if (isset($headers['connection']) && $headers['connection'] == 'close') { - $this->close(); - } - - return $response; - } - - /** - * Close the connection to the server. - */ - public function close() - { - if (is_resource($this->socket)) { - @fclose($this->socket); - } - $this->socket = null; - $this->connected_to = [null, null]; - } - - /** - * Check if the socket has timed out - if so close connection and throw - * an exception. - */ - protected function _checkSocketReadTimeout() - { - if ($this->socket) { - $info = stream_get_meta_data($this->socket); - $timedout = $info['timed_out']; - if ($timedout) { - $this->close(); - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - "Read timed out after {$this->config['timeout']} seconds", - Zend_Http_Client_Adapter_Exception::READ_TIMEOUT - ); - } - } - } - - /** - * Set output stream for the response. - * - * @param resource $stream - * - * @return Zend_Http_Client_Adapter_Socket - */ - public function setOutputStream($stream) - { - $this->out_stream = $stream; - - return $this; - } - - /** - * Destructor: make sure the socket is disconnected. - * - * If we are in persistent TCP mode, will not close the connection - */ - public function __destruct() - { - if (!$this->config['persistent']) { - if ($this->socket) { - $this->close(); - } - } - } -} diff --git a/library/Zend/Http/Client/Adapter/Stream.php b/library/Zend/Http/Client/Adapter/Stream.php deleted file mode 100755 index 27da2b94d..000000000 --- a/library/Zend/Http/Client/Adapter/Stream.php +++ /dev/null @@ -1,38 +0,0 @@ -_nextRequestWillFail = (bool) $flag; - - return $this; - } - - /** - * Set the configuration array for the adapter. - * - * @param array|Zend_Config $config - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Array or Zend_Config object expected, got ' . gettype($config) - ); - } - - foreach ($config as $k => $v) { - $this->config[strtolower($k)] = $v; - } - } - - /** - * Connect to the remote server. - * - * @param string $host - * @param int $port - * @param bool $secure - */ - public function connect($host, $port = 80, $secure = false) - { - if ($this->_nextRequestWillFail) { - $this->_nextRequestWillFail = false; - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception('Request failed'); - } - } - - /** - * Send request to the remote server. - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param string $http_ver - * @param array $headers - * @param string $body - * - * @return string Request as string - */ - public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') - { - $host = $uri->getHost(); - $host = (strtolower($uri->getScheme()) == 'https' ? 'sslv2://' . $host : $host); - - // Build request headers - $path = $uri->getPath(); - if ($uri->getQuery()) { - $path .= '?' . $uri->getQuery(); - } - $request = "{$method} {$path} HTTP/{$http_ver}\r\n"; - foreach ($headers as $k => $v) { - if (is_string($k)) { - $v = ucfirst($k) . ": $v"; - } - $request .= "$v\r\n"; - } - - // Add the request body - $request .= "\r\n" . $body; - - // Do nothing - just return the request as string - - return $request; - } - - /** - * Return the response set in $this->setResponse(). - * - * @return string - */ - public function read() - { - if ($this->responseIndex >= count($this->responses)) { - $this->responseIndex = 0; - } - - return $this->responses[$this->responseIndex++]; - } - - /** - * Close the connection (dummy). - */ - public function close() - { - } - - /** - * Set the HTTP response(s) to be returned by this adapter. - * - * @param array|string|Zend_Http_Response $response - */ - public function setResponse($response) - { - if ($response instanceof Zend_Http_Response) { - $response = $response->asString("\r\n"); - } - - $this->responses = (array) $response; - $this->responseIndex = 0; - } - - /** - * Add another response to the response buffer. - * - * @param string Zend_Http_Response|$response - */ - public function addResponse($response) - { - if ($response instanceof Zend_Http_Response) { - $response = $response->asString("\r\n"); - } - - $this->responses[] = $response; - } - - /** - * Sets the position of the response buffer. Selects which - * response will be returned on the next call to read(). - * - * @param int $index - */ - public function setResponseIndex($index) - { - if ($index < 0 || $index >= count($this->responses)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - - throw new Zend_Http_Client_Adapter_Exception( - 'Index out of range of response buffer size'); - } - $this->responseIndex = $index; - } - - /** - * Retrieve the array of all configuration options. - * - * @return array - */ - public function getConfig() - { - return $this->config; - } -} diff --git a/library/Zend/Http/Client/Exception.php b/library/Zend/Http/Client/Exception.php deleted file mode 100644 index 9fffb817c..000000000 --- a/library/Zend/Http/Client/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ -name = (string) $name) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('Cookies must have a name'); - } - - if (!$this->domain = (string) $domain) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('Cookies must have a domain'); - } - - $this->value = (string) $value; - $this->expires = ($expires === null ? null : (int) $expires); - $this->path = ($path ?: '/'); - $this->secure = $secure; - } - - /** - * Get Cookie name. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Get cookie value. - * - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Get cookie domain. - * - * @return string - */ - public function getDomain() - { - return $this->domain; - } - - /** - * Get the cookie path. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Get the expiry time of the cookie, or null if no expiry time is set. - * - * @return null|int - */ - public function getExpiryTime() - { - return $this->expires; - } - - /** - * Check whether the cookie should only be sent over secure connections. - * - * @return bool - */ - public function isSecure() - { - return $this->secure; - } - - /** - * Check whether the cookie has expired. - * - * Always returns false if the cookie is a session cookie (has no expiry time) - * - * @param int $now Timestamp to consider as "now" - * - * @return bool - */ - public function isExpired($now = null) - { - if ($now === null) { - $now = time(); - } - if (is_int($this->expires) && $this->expires < $now) { - return true; - } - - return false; - } - - /** - * Check whether the cookie is a session cookie (has no expiry time set). - * - * @return bool - */ - public function isSessionCookie() - { - return $this->expires === null; - } - - /** - * Checks whether the cookie should be sent or not in a specific scenario. - * - * @param string|Zend_Uri_Http $uri URI to check against (secure, domain, path) - * @param bool $matchSessionCookies Whether to send session cookies - * @param int $now Override the current time when checking for expiry time - * - * @return bool - */ - public function match($uri, $matchSessionCookies = true, $now = null) - { - if (is_string($uri)) { - $uri = Zend_Uri_Http::factory($uri); - } - - // Make sure we have a valid Zend_Uri_Http object - if (!($uri->valid() && ($uri->getScheme() == 'http' || $uri->getScheme() == 'https'))) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('Passed URI is not a valid HTTP or HTTPS URI'); - } - - // Check that the cookie is secure (if required) and not expired - if ($this->secure && $uri->getScheme() != 'https') { - return false; - } - if ($this->isExpired($now)) { - return false; - } - if ($this->isSessionCookie() && !$matchSessionCookies) { - return false; - } - - // Check if the domain matches - if (!self::matchCookieDomain($this->getDomain(), $uri->getHost())) { - return false; - } - - // Check that path matches using prefix match - if (!self::matchCookiePath($this->getPath(), $uri->getPath())) { - return false; - } - - // If we didn't die until now, return true. - return true; - } - - /** - * Get the cookie as a string, suitable for sending as a "Cookie" header in an - * HTTP request. - * - * @return string - */ - public function __toString() - { - if ($this->encodeValue) { - return $this->name . '=' . urlencode($this->value) . ';'; - } - - return $this->name . '=' . $this->value . ';'; - } - - /** - * Generate a new Cookie object from a cookie string - * (for example the value of the Set-Cookie HTTP header). - * - * @param string $cookieStr - * @param string|Zend_Uri_Http $refUri Reference URI for default values (domain, path) - * @param bool $encodeValue Whether or not the cookie's value should be - * passed through urlencode/urldecode - * - * @return Zend_Http_Cookie a new Zend_Http_Cookie object or false on failure - */ - public static function fromString($cookieStr, $refUri = null, $encodeValue = true) - { - // Set default values - if (is_string($refUri)) { - $refUri = Zend_Uri_Http::factory($refUri); - } - - $name = ''; - $value = ''; - $domain = ''; - $path = ''; - $expires = null; - $secure = false; - $parts = explode(';', $cookieStr); - - // If first part does not include '=', fail - if (strpos($parts[0], '=') === false) { - return false; - } - - // Get the name and value of the cookie - [$name, $value] = explode('=', trim(array_shift($parts)), 2); - $name = trim($name); - if ($encodeValue) { - $value = urldecode(trim($value)); - } - - // Set default domain and path - if ($refUri instanceof Zend_Uri_Http) { - $domain = $refUri->getHost(); - $path = $refUri->getPath(); - $path = substr($path, 0, strrpos($path, '/')); - } - - // Set other cookie parameters - foreach ($parts as $part) { - $part = trim($part); - if (strtolower($part) == 'secure') { - $secure = true; - - continue; - } - - $keyValue = explode('=', $part, 2); - if (count($keyValue) == 2) { - [$k, $v] = $keyValue; - switch (strtolower($k)) { - case 'expires': - if (($expires = strtotime($v)) === false) { - /** - * The expiration is past Tue, 19 Jan 2038 03:14:07 UTC - * the maximum for 32-bit signed integer. Zend_Date - * can get around that limit. - * - * @see Zend_Date - */ - require_once 'Zend/Date.php'; - - $expireDate = new Zend_Date($v); - $expires = $expireDate->getTimestamp(); - } - - break; - - case 'path': - $path = $v; - - break; - - case 'domain': - $domain = $v; - - break; - - default: - break; - } - } - } - - if ($name !== '') { - $ret = new self($name, $value, $domain, $expires, $path, $secure); - $ret->encodeValue = ($encodeValue) ? true : false; - - return $ret; - } - - return false; - } - - /** - * Check if a cookie's domain matches a host name. - * - * Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching - * - * @param string $cookieDomain - * @param string $host - * - * @return bool - */ - public static function matchCookieDomain($cookieDomain, $host) - { - if (!$cookieDomain) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('$cookieDomain is expected to be a cookie domain'); - } - - if (!$host) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('$host is expected to be a host name'); - } - - $cookieDomain = strtolower($cookieDomain); - $host = strtolower($host); - - if ($cookieDomain[0] == '.') { - $cookieDomain = substr($cookieDomain, 1); - } - - // Check for either exact match or suffix match - return $cookieDomain == $host - || preg_match('/\.' . preg_quote($cookieDomain) . '$/', $host); - } - - /** - * Check if a cookie's path matches a URL path. - * - * Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching - * - * @param string $cookiePath - * @param string $path - * - * @return bool - */ - public static function matchCookiePath($cookiePath, $path) - { - if (!$cookiePath) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('$cookiePath is expected to be a cookie path'); - } - - if (!$path) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('$path is expected to be a host name'); - } - - return strpos($path, $cookiePath) === 0; - } -} diff --git a/library/Zend/Http/CookieJar.php b/library/Zend/Http/CookieJar.php deleted file mode 100644 index 558e16506..000000000 --- a/library/Zend/Http/CookieJar.php +++ /dev/null @@ -1,453 +0,0 @@ -getDomain(); - $path = $cookie->getPath(); - if (!isset($this->cookies[$domain])) { - $this->cookies[$domain] = []; - } - if (!isset($this->cookies[$domain][$path])) { - $this->cookies[$domain][$path] = []; - } - $this->cookies[$domain][$path][$cookie->getName()] = $cookie; - $this->_rawCookies[] = $cookie; - } else { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('Supplient argument is not a valid cookie string or object'); - } - } - - /** - * Parse an HTTP response, adding all the cookies set in that response - * to the cookie jar. - * - * @param Zend_Http_Response $response - * @param string|Zend_Uri_Http $ref_uri Requested URI - * @param bool $encodeValue - */ - public function addCookiesFromResponse($response, $ref_uri, $encodeValue = true) - { - if (!$response instanceof Zend_Http_Response) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('$response is expected to be a Response object, ' - . gettype($response) . ' was passed'); - } - - $cookie_hdrs = $response->getHeader('Set-Cookie'); - - if (is_array($cookie_hdrs)) { - foreach ($cookie_hdrs as $cookie) { - $this->addCookie($cookie, $ref_uri, $encodeValue); - } - } elseif (is_string($cookie_hdrs)) { - $this->addCookie($cookie_hdrs, $ref_uri, $encodeValue); - } - } - - /** - * Get all cookies in the cookie jar as an array. - * - * @param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings - * - * @return array|string - */ - public function getAllCookies($ret_as = self::COOKIE_OBJECT) - { - $cookies = $this->_flattenCookiesArray($this->cookies, $ret_as); - if ($ret_as == self::COOKIE_STRING_CONCAT_STRICT) { - $cookies = rtrim(trim($cookies), ';'); - } - - return $cookies; - } - - /** - * Return an array of all cookies matching a specific request according to the request URI, - * whether session cookies should be sent or not, and the time to consider as "now" when - * checking cookie expiry time. - * - * @param string|Zend_Uri_Http $uri URI to check against (secure, domain, path) - * @param bool $matchSessionCookies Whether to send session cookies - * @param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings - * @param int $now Override the current time when checking for expiry time - * - * @return array|string - */ - public function getMatchingCookies($uri, $matchSessionCookies = true, - $ret_as = self::COOKIE_OBJECT, $now = null) - { - if (is_string($uri)) { - $uri = Zend_Uri::factory($uri); - } - if (!$uri instanceof Zend_Uri_Http) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('Invalid URI string or object passed'); - } - - // First, reduce the array of cookies to only those matching domain and path - $cookies = $this->_matchDomain($uri->getHost()); - $cookies = $this->_matchPath($cookies, $uri->getPath()); - $cookies = $this->_flattenCookiesArray($cookies, self::COOKIE_OBJECT); - - // Next, run Cookie->match on all cookies to check secure, time and session mathcing - $ret = []; - foreach ($cookies as $cookie) { - if ($cookie->match($uri, $matchSessionCookies, $now)) { - $ret[] = $cookie; - } - } - - // Now, use self::_flattenCookiesArray again - only to convert to the return format ;) - $ret = $this->_flattenCookiesArray($ret, $ret_as); - if ($ret_as == self::COOKIE_STRING_CONCAT_STRICT) { - $ret = rtrim(trim($ret), ';'); - } - - return $ret; - } - - /** - * Get a specific cookie according to a URI and name. - * - * @param string|Zend_Uri_Http $uri The uri (domain and path) to match - * @param string $cookie_name The cookie's name - * @param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings - * - * @return string|Zend_Http_Cookie - */ - public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT) - { - if (is_string($uri)) { - $uri = Zend_Uri::factory($uri); - } - - if (!$uri instanceof Zend_Uri_Http) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('Invalid URI specified'); - } - - // Get correct cookie path - $path = $uri->getPath(); - $path = substr($path, 0, strrpos($path, '/')); - if (!$path) { - $path = '/'; - } - - if (isset($this->cookies[$uri->getHost()][$path][$cookie_name])) { - $cookie = $this->cookies[$uri->getHost()][$path][$cookie_name]; - - switch ($ret_as) { - case self::COOKIE_OBJECT: - return $cookie; - - break; - - case self::COOKIE_STRING_CONCAT_STRICT: - return rtrim(trim($cookie->__toString()), ';'); - - break; - - case self::COOKIE_STRING_ARRAY: - case self::COOKIE_STRING_CONCAT: - return $cookie->__toString(); - - break; - - default: - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception("Invalid value passed for \$ret_as: {$ret_as}"); - - break; - } - } else { - return false; - } - } - - /** - * Helper function to recursivly flatten an array. Shoud be used when exporting the - * cookies array (or parts of it). - * - * @param array|Zend_Http_Cookie $ptr - * @param int $ret_as What value to return - * - * @return array|string - */ - protected function _flattenCookiesArray($ptr, $ret_as = self::COOKIE_OBJECT) - { - if (is_array($ptr)) { - $ret = ($ret_as == self::COOKIE_STRING_CONCAT || $ret_as == self::COOKIE_STRING_CONCAT_STRICT) ? '' : []; - foreach ($ptr as $item) { - if ($ret_as == self::COOKIE_STRING_CONCAT_STRICT) { - $postfix_combine = (!is_array($item) ? ' ' : ''); - $ret .= $this->_flattenCookiesArray($item, $ret_as) . $postfix_combine; - } elseif ($ret_as == self::COOKIE_STRING_CONCAT) { - $ret .= $this->_flattenCookiesArray($item, $ret_as); - } else { - $ret = array_merge($ret, $this->_flattenCookiesArray($item, $ret_as)); - } - } - - return $ret; - } - if ($ptr instanceof Zend_Http_Cookie) { - switch ($ret_as) { - case self::COOKIE_STRING_ARRAY: - return [$ptr->__toString()]; - - break; - - case self::COOKIE_STRING_CONCAT_STRICT: - // break intentionally omitted - - case self::COOKIE_STRING_CONCAT: - return $ptr->__toString(); - - break; - - case self::COOKIE_OBJECT: - default: - return [$ptr]; - - break; - } - } - - return null; - } - - /** - * Return a subset of the cookies array matching a specific domain. - * - * @param string $domain - * - * @return array - */ - protected function _matchDomain($domain) - { - $ret = []; - - foreach (array_keys($this->cookies) as $cdom) { - if (Zend_Http_Cookie::matchCookieDomain($cdom, $domain)) { - $ret[$cdom] = $this->cookies[$cdom]; - } - } - - return $ret; - } - - /** - * Return a subset of a domain-matching cookies that also match a specified path. - * - * @param string $path - * @param mixed $domains - * - * @return array - */ - protected function _matchPath($domains, $path) - { - $ret = []; - - foreach ($domains as $dom => $paths_array) { - foreach (array_keys($paths_array) as $cpath) { - if (Zend_Http_Cookie::matchCookiePath($cpath, $path)) { - if (!isset($ret[$dom])) { - $ret[$dom] = []; - } - - $ret[$dom][$cpath] = $paths_array[$cpath]; - } - } - } - - return $ret; - } - - /** - * Create a new CookieJar object and automatically load into it all the - * cookies set in an Http_Response object. If $uri is set, it will be - * considered as the requested URI for setting default domain and path - * of the cookie. - * - * @param Zend_Http_Response $response HTTP Response object - * @param mixed $ref_uri - * - * @return Zend_Http_CookieJar - * - * @todo Add the $uri functionality. - */ - public static function fromResponse(Zend_Http_Response $response, $ref_uri) - { - $jar = new self(); - $jar->addCookiesFromResponse($response, $ref_uri); - - return $jar; - } - - /** - * Required by Countable interface. - */ - public function count(): int - { - return count($this->_rawCookies); - } - - /** - * Required by IteratorAggregate interface. - * - * @return ArrayIterator - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->_rawCookies); - } - - /** - * Tells if the jar is empty of any cookie. - * - * @return bool - */ - public function isEmpty() - { - return count($this) == 0; - } - - /** - * Empties the cookieJar of any cookie. - * - * @return Zend_Http_CookieJar - */ - public function reset() - { - $this->cookies = $this->_rawCookies = []; - - return $this; - } -} diff --git a/library/Zend/Http/Exception.php b/library/Zend/Http/Exception.php deleted file mode 100644 index 2000c9308..000000000 --- a/library/Zend/Http/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ - 254 - ) { - continue; - } - - $string .= $value[$i]; - } - - return $string; - } - - /** - * Validate a header value. - * - * Per RFC 7230, only VISIBLE ASCII characters, spaces, and horizontal - * tabs are allowed in values; only one whitespace character is allowed - * between visible characters. - * - * @see http://en.wikipedia.org/wiki/HTTP_response_splitting - * - * @param string $value - * - * @return bool - */ - public static function isValid($value) - { - $value = (string) $value; - $length = strlen($value); - for ($i = 0; $i < $length; ++$i) { - $ascii = ord($value[$i]); - - // Non-visible, non-whitespace characters - // 9 === horizontal tab - // 32-126, 128-254 === visible - // 127 === DEL - // 255 === null byte - if (($ascii < 32 && $ascii !== 9) - || $ascii === 127 - || $ascii > 254 - ) { - return false; - } - } - - return true; - } - - /** - * Assert a header value is valid. - * - * @param string $value - */ - public static function assertValid($value) - { - if (!self::isValid($value)) { - require_once 'Zend/Http/Header/Exception/InvalidArgumentException.php'; - - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid header value'); - } - } -} diff --git a/library/Zend/Http/Header/SetCookie.php b/library/Zend/Http/Header/SetCookie.php deleted file mode 100644 index 88832a695..000000000 --- a/library/Zend/Http/Header/SetCookie.php +++ /dev/null @@ -1,576 +0,0 @@ -getName() === null) { - $header->setName($headerKey); - $header->setValue($headerValue); - - continue; - } - - // Process the remanining elements - switch (str_replace(['-', '_'], '', strtolower($headerKey))) { - case 'expires' : $header->setExpires($headerValue); - - break; - case 'domain' : $header->setDomain($headerValue); - - break; - case 'path' : $header->setPath($headerValue); - - break; - case 'secure' : $header->setSecure(true); - - break; - case 'httponly': $header->setHttponly(true); - - break; - case 'version' : $header->setVersion((int) $headerValue); - - break; - case 'maxage' : $header->setMaxAge((int) $headerValue); - - break; - default: - // Intentionally omitted - } - } - $headers[] = $header; - } - - return count($headers) == 1 ? array_pop($headers) : $headers; - } - - /** - * Cookie object constructor. - * - * @todo Add validation of each one of the parameters (legal domain, etc.) - * - * @param string $name - * @param string $value - * @param int $expires - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httponly - * @param string $maxAge - * @param int $version - * - * @return SetCookie - */ - public function __construct($name = null, $value = null, $expires = null, $path = null, $domain = null, $secure = false, $httponly = false, $maxAge = null, $version = null) - { - $this->type = 'Cookie'; - - if ($name) { - $this->setName($name); - } - - if ($value) { - $this->setValue($value); // in parent - } - - if ($version) { - $this->setVersion($version); - } - - if ($maxAge) { - $this->setMaxAge($maxAge); - } - - if ($domain) { - $this->setDomain($domain); - } - - if ($expires) { - $this->setExpires($expires); - } - - if ($path) { - $this->setPath($path); - } - - if ($secure) { - $this->setSecure($secure); - } - - if ($httponly) { - $this->setHttponly($httponly); - } - } - - /** - * @return string 'Set-Cookie' - */ - public function getFieldName() - { - return 'Set-Cookie'; - } - - /** - * @return string - */ - public function getFieldValue() - { - if ($this->getName() == '') { - throw new Zend_Http_Header_Exception_RuntimeException('A cookie name is required to generate a field value for this cookie'); - } - - $value = $this->getValue(); - if (strpos($value,'"') !== false) { - $value = '"' . urlencode(str_replace('"', '', $value)) . '"'; - } else { - $value = urlencode($value); - } - $fieldValue = $this->getName() . '=' . $value; - - $version = $this->getVersion(); - if ($version !== null) { - $fieldValue .= '; Version=' . $version; - } - - $maxAge = $this->getMaxAge(); - if ($maxAge !== null) { - $fieldValue .= '; Max-Age=' . $maxAge; - } - - $expires = $this->getExpires(); - if ($expires) { - $fieldValue .= '; Expires=' . $expires; - } - - $domain = $this->getDomain(); - if ($domain) { - $fieldValue .= '; Domain=' . $domain; - } - - $path = $this->getPath(); - if ($path) { - $fieldValue .= '; Path=' . $path; - } - - if ($this->isSecure()) { - $fieldValue .= '; Secure'; - } - - if ($this->isHttponly()) { - $fieldValue .= '; HttpOnly'; - } - - return $fieldValue; - } - - /** - * @param string $name - * - * @return SetCookie - */ - public function setName($name) - { - if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException("Cookie name cannot contain these characters: =,; \\t\\r\\n\\013\\014 ({$name})"); - } - - $this->name = $name; - - return $this; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $value - */ - public function setValue($value) - { - Zend_Http_Header_HeaderValue::assertValid($value); - $this->value = $value; - - return $this; - } - - /** - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Set version. - * - * @param int $version - */ - public function setVersion($version) - { - if (!is_int($version)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid Version number specified'); - } - $this->version = $version; - } - - /** - * Get version. - * - * @return int - */ - public function getVersion() - { - return $this->version; - } - - /** - * Set Max-Age. - * - * @param int $maxAge - */ - public function setMaxAge($maxAge) - { - if (!is_int($maxAge) || ($maxAge < 0)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid Max-Age number specified'); - } - $this->maxAge = $maxAge; - } - - /** - * Get Max-Age. - * - * @return int - */ - public function getMaxAge() - { - return $this->maxAge; - } - - /** - * @param int $expires - * - * @return SetCookie - */ - public function setExpires($expires) - { - if (!empty($expires)) { - if (is_string($expires)) { - $expires = strtotime($expires); - } elseif (!is_int($expires)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid expires time specified'); - } - $this->expires = (int) $expires; - } - - return $this; - } - - /** - * @param mixed $inSeconds - * - * @return int - */ - public function getExpires($inSeconds = false) - { - if ($this->expires == null) { - return; - } - if ($inSeconds) { - return $this->expires; - } - - return gmdate('D, d-M-Y H:i:s', $this->expires) . ' GMT'; - } - - /** - * @param string $domain - */ - public function setDomain($domain) - { - Zend_Http_Header_HeaderValue::assertValid($domain); - $this->domain = $domain; - - return $this; - } - - /** - * @return string - */ - public function getDomain() - { - return $this->domain; - } - - /** - * @param string $path - */ - public function setPath($path) - { - Zend_Http_Header_HeaderValue::assertValid($path); - $this->path = $path; - - return $this; - } - - /** - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * @param bool $secure - */ - public function setSecure($secure) - { - $this->secure = $secure; - - return $this; - } - - /** - * @return bool - */ - public function isSecure() - { - return $this->secure; - } - - /** - * @param bool $httponly - */ - public function setHttponly($httponly) - { - $this->httponly = $httponly; - - return $this; - } - - /** - * @return bool - */ - public function isHttponly() - { - return $this->httponly; - } - - /** - * Check whether the cookie has expired. - * - * Always returns false if the cookie is a session cookie (has no expiry time) - * - * @param int $now Timestamp to consider as "now" - * - * @return bool - */ - public function isExpired($now = null) - { - if ($now === null) { - $now = time(); - } - - if (is_int($this->expires) && $this->expires < $now) { - return true; - } - - return false; - } - - /** - * Check whether the cookie is a session cookie (has no expiry time set). - * - * @return bool - */ - public function isSessionCookie() - { - return $this->expires === null; - } - - public function isValidForRequest($requestDomain, $path, $isSecure = false) - { - if ($this->getDomain() && (strrpos($requestDomain, $this->getDomain()) !== false)) { - return false; - } - - if ($this->getPath() && (strpos($path, $this->getPath()) !== 0)) { - return false; - } - - if ($this->secure && $this->isSecure() !== $isSecure) { - return false; - } - - return true; - } - - public function toString() - { - return $this->getFieldName() . ': ' . $this->getFieldValue(); - } - - public function __toString() - { - return $this->toString(); - } - - public function toStringMultipleHeaders(array $headers) - { - $headerLine = $this->toString(); - // @var $header SetCookie - foreach ($headers as $header) { - if (!$header instanceof Zend_Http_Header_SetCookie) { - throw new Zend_Http_Header_Exception_RuntimeException( - 'The SetCookie multiple header implementation can only accept an array of SetCookie headers' - ); - } - $headerLine .= ', ' . $header->getFieldValue(); - } - - return $headerLine; - } -} diff --git a/library/Zend/Http/Response.php b/library/Zend/Http/Response.php deleted file mode 100644 index b54040cc4..000000000 --- a/library/Zend/Http/Response.php +++ /dev/null @@ -1,725 +0,0 @@ - 'Continue', - 101 => 'Switching Protocols', - - // Success 2xx - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - - // Redirection 3xx - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', // 1.1 - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - // 306 is deprecated but reserved - 307 => 'Temporary Redirect', - - // Client Error 4xx - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - - // Server Error 5xx - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported', - 509 => 'Bandwidth Limit Exceeded', - ]; - - /** - * The HTTP version (1.0, 1.1). - * - * @var string - */ - protected $version; - - /** - * The HTTP response code. - * - * @var int - */ - protected $code; - - /** - * The HTTP response code as string - * (e.g. 'Not Found' for 404 or 'Internal Server Error' for 500). - * - * @var string - */ - protected $message; - - /** - * The HTTP response headers array. - * - * @var array - */ - protected $headers = []; - - /** - * The HTTP response body. - * - * @var string - */ - protected $body; - - /** - * HTTP response constructor. - * - * In most cases, you would use Zend_Http_Response::fromString to parse an HTTP - * response string and create a new Zend_Http_Response object. - * - * NOTE: The constructor no longer accepts nulls or empty values for the code and - * headers and will throw an exception if the passed values do not form a valid HTTP - * responses. - * - * If no message is passed, the message will be guessed according to the response code. - * - * @param int $code Response code (200, 404, ...) - * @param array $headers Headers array - * @param string $body Response body - * @param string $version HTTP version - * @param string $message Response code as text - */ - public function __construct($code, array $headers, $body = null, $version = '1.1', $message = null) - { - // Make sure the response code is valid and set it - if (self::responseCodeAsText($code) === null) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception("{$code} is not a valid HTTP response code"); - } - - $this->code = $code; - - foreach ($headers as $name => $value) { - if (is_int($name)) { - $header = explode(':', $value, 2); - if (count($header) != 2) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception("'{$value}' is not a valid HTTP header"); - } - - $name = trim($header[0]); - $value = trim($header[1]); - } - - $this->headers[ucwords(strtolower($name))] = $value; - } - - // Set the body - $this->body = $body; - - // Set the HTTP version - if (!preg_match('|^\d\.\d$|', $version)) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception("Invalid HTTP response version: $version"); - } - - $this->version = $version; - - // If we got the response message, set it. Else, set it according to - // the response code - if (is_string($message)) { - $this->message = $message; - } else { - $this->message = self::responseCodeAsText($code); - } - } - - /** - * Check whether the response is an error. - * - * @return bool - */ - public function isError() - { - $restype = floor($this->code / 100); - if ($restype == 4 || $restype == 5) { - return true; - } - - return false; - } - - /** - * Check whether the response in successful. - * - * @return bool - */ - public function isSuccessful() - { - $restype = floor($this->code / 100); - if ($restype == 2 || $restype == 1) { // Shouldn't 3xx count as success as well ??? - return true; - } - - return false; - } - - /** - * Check whether the response is a redirection. - * - * @return bool - */ - public function isRedirect() - { - $restype = floor($this->code / 100); - if ($restype == 3) { - return true; - } - - return false; - } - - /** - * Get the response body as string. - * - * This method returns the body of the HTTP response (the content), as it - * should be in it's readable version - that is, after decoding it (if it - * was decoded), deflating it (if it was gzip compressed), etc. - * - * If you want to get the raw body (as transfered on wire) use - * $this->getRawBody() instead. - * - * @return string - */ - public function getBody() - { - $body = ''; - - // Decode the body if it was transfer-encoded - switch (strtolower($this->getHeader('transfer-encoding') ?? '')) { - // Handle chunked body - case 'chunked': - $body = self::decodeChunkedBody($this->body); - - break; - - // No transfer encoding, or unknown encoding extension: - // return body as is - default: - $body = $this->body; - - break; - } - - // Decode any content-encoding (gzip or deflate) if needed - switch (strtolower($this->getHeader('content-encoding') ?? '')) { - // Handle gzip encoding - case 'gzip': - $body = self::decodeGzip($body); - - break; - - // Handle deflate encoding - case 'deflate': - $body = self::decodeDeflate($body); - - break; - - default: - break; - } - - return $body; - } - - /** - * Get the raw response body (as transfered "on wire") as string. - * - * If the body is encoded (with Transfer-Encoding, not content-encoding - - * IE "chunked" body), gzip compressed, etc. it will not be decoded. - * - * @return string - */ - public function getRawBody() - { - return $this->body; - } - - /** - * Get the HTTP version of the response. - * - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Get the HTTP response status code. - * - * @return int - */ - public function getStatus() - { - return $this->code; - } - - /** - * Return a message describing the HTTP response code - * (Eg. "OK", "Not Found", "Moved Permanently"). - * - * @return string - */ - public function getMessage() - { - return $this->message; - } - - /** - * Get the response headers. - * - * @return array - */ - public function getHeaders() - { - return $this->headers; - } - - /** - * Get a specific header as string, or null if it is not set. - * - * @param string$header - * - * @return null|array|string - */ - public function getHeader($header) - { - $header = ucwords(strtolower($header)); - if (!is_string($header) || !isset($this->headers[$header])) { - return null; - } - - return $this->headers[$header]; - } - - /** - * Get all headers as string. - * - * @param bool $status_line Whether to return the first status line (IE "HTTP 200 OK") - * @param string $br Line breaks (eg. "\n", "\r\n", "
") - * - * @return string - */ - public function getHeadersAsString($status_line = true, $br = "\n") - { - $str = ''; - - if ($status_line) { - $str = "HTTP/{$this->version} {$this->code} {$this->message}{$br}"; - } - - // Iterate over the headers and stringify them - foreach ($this->headers as $name => $value) { - if (is_string($value)) { - $str .= "{$name}: {$value}{$br}"; - } elseif (is_array($value)) { - foreach ($value as $subval) { - $str .= "{$name}: {$subval}{$br}"; - } - } - } - - return $str; - } - - /** - * Get the entire response as string. - * - * @param string $br Line breaks (eg. "\n", "\r\n", "
") - * - * @return string - */ - public function asString($br = "\r\n") - { - return $this->getHeadersAsString(true, $br) . $br . $this->getRawBody(); - } - - /** - * Implements magic __toString(). - * - * @return string - */ - public function __toString() - { - return $this->asString(); - } - - /** - * A convenience function that returns a text representation of - * HTTP response codes. Returns 'Unknown' for unknown codes. - * Returns array of all codes, if $code is not specified. - * - * Conforms to HTTP/1.1 as defined in RFC 2616 (except for 'Unknown') - * See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10 for reference - * - * @param int $code HTTP response code - * @param bool $http11 Use HTTP version 1.1 - * - * @return string - */ - public static function responseCodeAsText($code = null, $http11 = true) - { - $messages = self::$messages; - if (!$http11) { - $messages[302] = 'Moved Temporarily'; - } - - if ($code === null) { - return $messages; - } - if (isset($messages[$code])) { - return $messages[$code]; - } - - return 'Unknown'; - } - - /** - * Extract the response code from a response string. - * - * @param string $response_str - * - * @return int - */ - public static function extractCode($response_str) - { - preg_match("|^HTTP/[\d\.x]+ (\d+)|", $response_str, $m); - - if (isset($m[1])) { - return (int) $m[1]; - } - - return false; - } - - /** - * Extract the HTTP message from a response. - * - * @param string $response_str - * - * @return string - */ - public static function extractMessage($response_str) - { - preg_match("|^HTTP/[\d\.x]+ \d+ ([^\r\n]+)|", $response_str, $m); - - if (isset($m[1])) { - return $m[1]; - } - - return false; - } - - /** - * Extract the HTTP version from a response. - * - * @param string $response_str - * - * @return string - */ - public static function extractVersion($response_str) - { - preg_match("|^HTTP/([\d\.x]+) \d+|", $response_str, $m); - - if (isset($m[1])) { - return $m[1]; - } - - return false; - } - - /** - * Extract the headers from a response string. - * - * @param string $response_str - * - * @return array - */ - public static function extractHeaders($response_str) - { - $headers = []; - - // First, split body and headers. Headers are separated from the - // message at exactly the sequence "\r\n\r\n" - $parts = preg_split('|(?:\r\n){2}|m', $response_str, 2); - if (!$parts[0]) { - return $headers; - } - - // Split headers part to lines; "\r\n" is the only valid line separator. - $lines = explode("\r\n", $parts[0]); - unset($parts); - $last_header = null; - - foreach ($lines as $index => $line) { - if ($index === 0 && preg_match('#^HTTP/\d+(?:\.\d+) [1-5]\d+#', $line)) { - // Status line; ignore - continue; - } - - if ($line == '') { - // Done processing headers - break; - } - - // Locate headers like 'Location: ...' and 'Location:...' (note the missing space) - if (preg_match("|^([a-zA-Z0-9\'`#$%&*+.^_\|\~!-]+):\s*(.*)|s", $line, $m)) { - unset($last_header); - $h_name = strtolower($m[1]); - $h_value = $m[2]; - Zend_Http_Header_HeaderValue::assertValid($h_value); - - if (isset($headers[$h_name])) { - if (!is_array($headers[$h_name])) { - $headers[$h_name] = [$headers[$h_name]]; - } - - $headers[$h_name][] = ltrim($h_value); - $last_header = $h_name; - - continue; - } - - $headers[$h_name] = ltrim($h_value); - $last_header = $h_name; - - continue; - } - - // Identify header continuations - if (preg_match("|^[ \t](.+)$|s", $line, $m) && $last_header !== null) { - $h_value = trim($m[1]); - if (is_array($headers[$last_header])) { - $last_header_key = array_key_last($headers[$last_header]); - - $h_value = $headers[$last_header][$last_header_key] . $h_value; - Zend_Http_Header_HeaderValue::assertValid($h_value); - - $headers[$last_header][$last_header_key] = $h_value; - - continue; - } - - $h_value = $headers[$last_header] . $h_value; - Zend_Http_Header_HeaderValue::assertValid($h_value); - - $headers[$last_header] = $h_value; - - continue; - } - - // Anything else is an error condition - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception('Invalid header line detected'); - } - - return $headers; - } - - /** - * Extract the body from a response string. - * - * @param string $response_str - * - * @return string - */ - public static function extractBody($response_str) - { - $parts = preg_split('|(?:\r\n){2}|m', $response_str, 2); - if (isset($parts[1])) { - return $parts[1]; - } - - return ''; - } - - /** - * Decode a "chunked" transfer-encoded body and return the decoded text. - * - * @param string $body - * - * @return string - */ - public static function decodeChunkedBody($body) - { - $decBody = ''; - - // If mbstring overloads substr and strlen functions, we have to - // override it's internal encoding - if (function_exists('mb_internal_encoding') - && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbIntEnc = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } - - while (trim($body)) { - if (!preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception("Error parsing body - doesn't seem to be a chunked message"); - } - - $length = hexdec(trim($m[1])); - $cut = strlen($m[0]); - $decBody .= substr($body, $cut, $length); - $body = substr($body, $cut + $length + 2); - } - - if (isset($mbIntEnc)) { - mb_internal_encoding($mbIntEnc); - } - - return $decBody; - } - - /** - * Decode a gzip encoded message (when Content-encoding = gzip). - * - * Currently requires PHP with zlib support - * - * @param string $body - * - * @return string - */ - public static function decodeGzip($body) - { - if (!function_exists('gzinflate')) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception( - 'zlib extension is required in order to decode "gzip" encoding' - ); - } - - return gzinflate(substr($body, 10)); - } - - /** - * Decode a zlib deflated message (when Content-encoding = deflate). - * - * Currently requires PHP with zlib support - * - * @param string $body - * - * @return string - */ - public static function decodeDeflate($body) - { - if (!function_exists('gzuncompress')) { - require_once 'Zend/Http/Exception.php'; - - throw new Zend_Http_Exception( - 'zlib extension is required in order to decode "deflate" encoding' - ); - } - - /** - * Some servers (IIS ?) send a broken deflate response, without the - * RFC-required zlib header. - * - * We try to detect the zlib header, and if it does not exsit we - * teat the body is plain DEFLATE content. - * - * This method was adapted from PEAR HTTP_Request2 by (c) Alexey Borzov - * - * @see http://framework.zend.com/issues/browse/ZF-6040 - */ - $zlibHeader = unpack('n', substr($body, 0, 2)); - if ($zlibHeader[1] % 31 == 0 && ord($body[0]) == 0x78 && in_array(ord($body[1]), [0x01, 0x5E, 0x9C, 0xDA])) { - return gzuncompress($body); - } - - return gzinflate($body); - } - - /** - * Create a new Zend_Http_Response object from a string. - * - * @param string $response_str - * - * @return Zend_Http_Response - */ - public static function fromString($response_str) - { - $code = self::extractCode($response_str); - $headers = self::extractHeaders($response_str); - $body = self::extractBody($response_str); - $version = self::extractVersion($response_str); - $message = self::extractMessage($response_str); - - return new Zend_Http_Response($code, $headers, $body, $version, $message); - } -} diff --git a/library/Zend/Http/Response/Stream.php b/library/Zend/Http/Response/Stream.php deleted file mode 100755 index 47b606780..000000000 --- a/library/Zend/Http/Response/Stream.php +++ /dev/null @@ -1,238 +0,0 @@ -stream; - } - - /** - * Set the response stream. - * - * @param resourse $stream - * - * @return Zend_Http_Response_Stream - */ - public function setStream($stream) - { - $this->stream = $stream; - - return $this; - } - - /** - * Get the cleanup trigger. - * - * @return bool - */ - public function getCleanup() - { - return $this->_cleanup; - } - - /** - * Set the cleanup trigger. - * - * @param bool $cleanup Set cleanup trigger - */ - public function setCleanup($cleanup = true) - { - $this->_cleanup = $cleanup; - } - - /** - * Get file name associated with the stream. - * - * @return string - */ - public function getStreamName() - { - return $this->stream_name; - } - - /** - * Set file name associated with the stream. - * - * @param string $stream_name Name to set - * - * @return Zend_Http_Response_Stream - */ - public function setStreamName($stream_name) - { - $this->stream_name = $stream_name; - - return $this; - } - - /** - * HTTP response constructor. - * - * In most cases, you would use Zend_Http_Response::fromString to parse an HTTP - * response string and create a new Zend_Http_Response object. - * - * NOTE: The constructor no longer accepts nulls or empty values for the code and - * headers and will throw an exception if the passed values do not form a valid HTTP - * responses. - * - * If no message is passed, the message will be guessed according to the response code. - * - * @param int $code Response code (200, 404, ...) - * @param array $headers Headers array - * @param string $body Response body - * @param string $version HTTP version - * @param string $message Response code as text - */ - public function __construct($code, $headers, $body = null, $version = '1.1', $message = null) - { - if (is_resource($body)) { - $this->setStream($body); - $body = ''; - } - parent::__construct($code, $headers, $body, $version, $message); - } - - /** - * Create a new Zend_Http_Response_Stream object from a string. - * - * @param string $response_str - * @param resource $stream - * - * @return Zend_Http_Response_Stream - */ - public static function fromStream($response_str, $stream) - { - $code = self::extractCode($response_str); - $headers = self::extractHeaders($response_str); - $version = self::extractVersion($response_str); - $message = self::extractMessage($response_str); - - return new self($code, $headers, $stream, $version, $message); - } - - /** - * Get the response body as string. - * - * This method returns the body of the HTTP response (the content), as it - * should be in it's readable version - that is, after decoding it (if it - * was decoded), deflating it (if it was gzip compressed), etc. - * - * If you want to get the raw body (as transfered on wire) use - * $this->getRawBody() instead. - * - * @return string - */ - public function getBody() - { - if ($this->stream != null) { - $this->readStream(); - } - - return parent::getBody(); - } - - /** - * Get the raw response body (as transfered "on wire") as string. - * - * If the body is encoded (with Transfer-Encoding, not content-encoding - - * IE "chunked" body), gzip compressed, etc. it will not be decoded. - * - * @return string - */ - public function getRawBody() - { - if ($this->stream) { - $this->readStream(); - } - - return $this->body; - } - - /** - * Read stream content and return it as string. - * - * Function reads the remainder of the body from the stream and closes the stream. - * - * @return string - */ - protected function readStream() - { - $headers = []; - if (!is_resource($this->stream)) { - return ''; - } - - if (isset($headers['content-length'])) { - $this->body = stream_get_contents($this->stream, $headers['content-length']); - } else { - $this->body = stream_get_contents($this->stream); - } - fclose($this->stream); - $this->stream = null; - } - - public function __destruct() - { - if (is_resource($this->stream)) { - fclose($this->stream); - $this->stream = null; - } - if ($this->_cleanup) { - @unlink($this->stream_name); - } - } -} diff --git a/library/Zend/Http/UserAgent.php b/library/Zend/Http/UserAgent.php deleted file mode 100644 index 5ce65ee30..000000000 --- a/library/Zend/Http/UserAgent.php +++ /dev/null @@ -1,895 +0,0 @@ - self::DEFAULT_IDENTIFICATION_SEQUENCE, - 'storage' => [ - 'adapter' => self::DEFAULT_PERSISTENT_STORAGE_ADAPTER, - ], - ]; - - /** - * Identified device. - * - * @var Zend_Http_UserAgent_Device - */ - protected $_device; - - /** - * Whether or not this instance is immutable. - * - * If true, none of the following may be modified: - * - $_server - * - $_browserType - * - User-Agent (defined in $_server) - * - HTTP Accept value (defined in $_server) - * - $_storage - * - * @var bool - */ - protected $_immutable = false; - - /** - * Plugin loaders. - * - * @var array - */ - protected $_loaders = []; - - /** - * Valid plugin loader types. - * - * @var array - */ - protected $_loaderTypes = ['storage', 'device']; - - /** - * Trace of items matched to identify the browser type. - * - * @var array - */ - protected $_matchLog = []; - - /** - * Server variable. - * - * @var array - */ - protected $_server; - - /** - * Persistent storage handler. - * - * @var Zend_Http_UserAgent_Storage - */ - protected $_storage; - - /** - * Constructor. - * - * @param null|array|ArrayAccess|Zend_Config $options - */ - public function __construct($options = null) - { - if (null !== $options) { - $this->setOptions($options); - } - } - - /** - * Serialized representation of the object. - * - * @return string - */ - public function serialize() - { - $spec = $this->__serialize(); - - return serialize($spec); - } - - public function __serialize(): array - { - $device = $this->getDevice(); - - return [ - 'browser_type' => $this->_browserType, - 'config' => $this->_config, - 'device_class' => get_class($device), - 'device' => $device->serialize(), - 'user_agent' => $this->getServerValue('http_user_agent'), - 'http_accept' => $this->getServerValue('http_accept'), - ]; - } - - /** - * Unserialize a previous representation of the object. - * - * @param string $serialized - */ - public function unserialize($serialized) - { - $spec = unserialize($serialized); - $this->__unserialize($spec); - } - - public function __unserialize(array $spec): void - { - $this->setOptions($spec); - - // Determine device class and ensure the class is loaded - $deviceClass = $spec['device_class']; - if (!class_exists($deviceClass)) { - $this->_getUserAgentDevice($this->getBrowserType()); - } - - // Get device specification and instantiate - $deviceSpec = unserialize($spec['device']); - $deviceSpec['_config'] = $this->getConfig(); - $deviceSpec['_server'] = $this->getServer(); - $this->_device = new $deviceClass($deviceSpec); - } - - /** - * Configure instance. - * - * @param array|ArrayAccess|Zend_Config $options - * - * @return Zend_Http_UserAgent - */ - public function setOptions($options) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - - if (!is_array($options) - && !$options instanceof ArrayAccess - && !$options instanceof Traversable - ) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Invalid argument; expected array, Zend_Config object, or object implementing ArrayAccess and Traversable; received %s', - (is_object($options) ? get_class($options) : gettype($options)) - )); - } - - // Set $_SERVER first - if (isset($options['server'])) { - $this->setServer($options['server']); - unset($options['server']); - } - - // Get plugin loaders sorted - if (isset($options['plugin_loader'])) { - $plConfig = $options['plugin_loader']; - if (is_iterable($plConfig)) { - foreach ($plConfig as $type => $class) { - $this->setPluginLoader($type, $class); - } - } - unset($plConfig, $options['plugin_loader']); - } - - // And then loop through the remaining options - $config = []; - foreach ($options as $key => $value) { - switch (strtolower($key)) { - case 'browser_type': - $this->setBrowserType($value); - - break; - case 'http_accept': - $this->setHttpAccept($value); - - break; - case 'user_agent': - $this->setUserAgent($value); - - break; - default: - // Cache remaining options for $_config - $config[$key] = $value; - - break; - } - } - $this->setConfig($config); - - return $this; - } - - /** - * Comparison of the UserAgent chain and browser signatures. - * - * The comparison is case-insensitive : the browser signatures must be in lower - * case - * - * @param string $deviceClass Name of class against which a match will be attempted - * - * @return bool - */ - protected function _match($deviceClass) - { - // Validate device class - $r = new ReflectionClass($deviceClass); - if (!$r->implementsInterface(\Zend_Http_UserAgent_Device::class)) { - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Invalid device class provided ("%s"); must implement Zend_Http_UserAgent_Device', - $deviceClass - )); - } - - $userAgent = $this->getUserAgent(); - - // Call match method on device class - return call_user_func( - [$deviceClass, 'match'], - $userAgent, - $this->getServer() - ); - } - - /** - * Loads class for a user agent device. - * - * @param string $browserType Browser type - * - * @return string - */ - protected function _getUserAgentDevice($browserType) - { - $browserType = strtolower($browserType); - if (isset($this->_browserTypeClass[$browserType])) { - return $this->_browserTypeClass[$browserType]; - } - - if (isset($this->_config[$browserType], $this->_config[$browserType]['device']) - - ) { - $deviceConfig = $this->_config[$browserType]['device']; - if (is_array($deviceConfig) && isset($deviceConfig['classname'])) { - $device = (string) $deviceConfig['classname']; - if (!class_exists($device)) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Invalid classname "%s" provided in device configuration for browser type "%s"', - $device, - $browserType - )); - } - } elseif (is_array($deviceConfig) && isset($deviceConfig['path'])) { - $loader = $this->getPluginLoader('device'); - $path = $deviceConfig['path']; - $prefix = $deviceConfig['prefix'] ?? \Zend_Http_UserAgent::class; - $loader->addPrefixPath($prefix, $path); - - $device = $loader->load($browserType); - } else { - $loader = $this->getPluginLoader('device'); - $device = $loader->load($browserType); - } - } else { - $loader = $this->getPluginLoader('device'); - $device = $loader->load($browserType); - } - - $this->_browserTypeClass[$browserType] = $device; - - return $device; - } - - /** - * Returns the User Agent value. - * - * If $userAgent param is null, the value of $_server['HTTP_USER_AGENT'] is - * returned. - * - * @return string - */ - public function getUserAgent() - { - if (null === ($ua = $this->getServerValue('http_user_agent'))) { - $ua = self::DEFAULT_HTTP_USER_AGENT; - $this->setUserAgent($ua); - } - - return $ua; - } - - /** - * Force or replace the UA chain in $_server variable. - * - * @param string $userAgent Forced UserAgent chain - * - * @return Zend_Http_UserAgent - */ - public function setUserAgent($userAgent) - { - $this->setServerValue('http_user_agent', $userAgent); - - return $this; - } - - /** - * Returns the HTTP Accept server param. - * - * @param string $httpAccept (option) forced HTTP Accept chain - * - * @return string - */ - public function getHttpAccept($httpAccept = null) - { - if (null === ($accept = $this->getServerValue('http_accept'))) { - $accept = self::DEFAULT_HTTP_ACCEPT; - $this->setHttpAccept($accept); - } - - return $accept; - } - - /** - * Force or replace the HTTP_ACCEPT chain in self::$_server variable. - * - * @param string $httpAccept Forced HTTP Accept chain - * - * @return Zend_Http_UserAgent - */ - public function setHttpAccept($httpAccept) - { - $this->setServerValue('http_accept', $httpAccept); - - return $this; - } - - /** - * Returns the persistent storage handler. - * - * Session storage is used by default unless a different storage adapter - * has been set via the "persistent_storage_adapter" key. That key should - * contain either a fully qualified class name, or a short name that - * resolves via the plugin loader. - * - * @param string $browser Browser identifier (User Agent chain) - * - * @return Zend_Http_UserAgent_Storage - */ - public function getStorage($browser = null) - { - if (null === $browser) { - $browser = $this->getUserAgent(); - } - if (null === $this->_storage) { - $config = $this->_config['storage']; - $adapter = $config['adapter']; - if (!class_exists($adapter)) { - $loader = $this->getPluginLoader('storage'); - $adapter = $loader->load($adapter); - $loader = $this->getPluginLoader('storage'); - } - $options = ['browser_type' => $browser]; - if (isset($config['options'])) { - $options = array_merge($options, $config['options']); - } - $this->setStorage(new $adapter($options)); - } - - return $this->_storage; - } - - /** - * Sets the persistent storage handler. - * - * @return Zend_Http_UserAgent - */ - public function setStorage(Zend_Http_UserAgent_Storage $storage) - { - if ($this->_immutable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception( - 'The User-Agent device object has already been retrieved; the storage object is now immutable' - ); - } - - $this->_storage = $storage; - - return $this; - } - - /** - * Clean the persistent storage. - * - * @param string $browser Browser identifier (User Agent chain) - */ - public function clearStorage($browser = null) - { - $this->getStorage($browser)->clear(); - } - - /** - * Get user configuration. - * - * @return array - */ - public function getConfig() - { - return $this->_config; - } - - /** - * Config parameters is an Array or a Zend_Config object. - * - * The allowed parameters are : - * - the identification sequence (can be empty) => desktop browser type is the - * default browser type returned - * $config['identification_sequence'] : ',' separated browser types - * - the persistent storage adapter - * $config['persistent_storage_adapter'] = "Session" or "NonPersistent" - * - to add or replace a browser type device - * $config[(type)]['device']['path'] - * $config[(type)]['device']['classname'] - * - to add or replace a browser type features adapter - * $config[(type)]['features']['path'] - * $config[(type)]['features']['classname'] - * - * @param mixed $config (option) Config array - * - * @return Zend_Http_UserAgent - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } - - // Verify that Config parameters are in an array. - if (!is_array($config) && !$config instanceof Traversable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Config parameters must be in an array or a Traversable object; received "%s"', - (is_object($config) ? get_class($config) : gettype($config)) - )); - } - - if ($config instanceof Traversable) { - $tmp = []; - foreach ($config as $key => $value) { - $tmp[$key] = $value; - } - $config = $tmp; - unset($tmp); - } - - $this->_config = array_merge($this->_config, $config); - - return $this; - } - - /** - * Returns the device object. - * - * This is the object that will contain the various discovered device - * capabilities. - * - * @return Zend_Http_UserAgent_Device $device - */ - public function getDevice() - { - if (null !== $this->_device) { - return $this->_device; - } - - $userAgent = $this->getUserAgent(); - - // search an existing identification in the session - $storage = $this->getStorage($userAgent); - - if (!$storage->isEmpty()) { - // If the user agent and features are already existing, the - // Zend_Http_UserAgent object is serialized in the session - $object = $storage->read(); - $this->unserialize($object); - } else { - // Otherwise, the identification is made and stored in the session. - // Find the browser type: - $this->setBrowserType($this->_matchUserAgent()); - $this->_createDevice(); - - // put the result in storage: - $this->getStorage($userAgent) - ->write($this->serialize()); - } - - // Mark the object as immutable - $this->_immutable = true; - - // Return the device instance - return $this->_device; - } - - /** - * Retrieve the browser type. - * - * @return string $browserType - */ - public function getBrowserType() - { - return $this->_browserType; - } - - /** - * Set the browser "type". - * - * @param string $browserType - * - * @return Zend_Http_UserAgent - */ - public function setBrowserType($browserType) - { - if ($this->_immutable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception( - 'The User-Agent device object has already been retrieved; the browser type is now immutable' - ); - } - - $this->_browserType = $browserType; - - return $this; - } - - /** - * Retrieve the "$_SERVER" array. - * - * Basically, the $_SERVER array or an equivalent container storing the - * data that will be introspected. - * - * If the value has not been previously set, it sets itself from the - * $_SERVER superglobal. - * - * @return array - */ - public function getServer() - { - if (null === $this->_server) { - $this->setServer($_SERVER); - } - - return $this->_server; - } - - /** - * Set the "$_SERVER" array. - * - * Basically, the $_SERVER array or an equivalent container storing the - * data that will be introspected. - * - * @param array|ArrayAccess $server - */ - public function setServer($server) - { - if ($this->_immutable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception( - 'The User-Agent device object has already been retrieved; the server array is now immutable' - ); - } - - if (!is_array($server) && !$server instanceof Traversable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Expected an array or object implementing Traversable; received %s', - (is_object($server) ? get_class($server) : gettype($server)) - )); - } - - // Get an array if we don't have one - if ($server instanceof ArrayObject) { - $server = $server->getArrayCopy(); - } elseif ($server instanceof Traversable) { - $tmp = []; - foreach ($server as $key => $value) { - $tmp[$key] = $value; - } - $server = $tmp; - unset($tmp); - } - - // Normalize key case - $server = array_change_key_case($server, CASE_LOWER); - - $this->_server = $server; - - return $this; - } - - /** - * Retrieve a server value. - * - * @param string $key - * - * @return mixed - */ - public function getServerValue($key) - { - $key = strtolower($key); - $server = $this->getServer(); - $return = null; - if (isset($server[$key])) { - $return = $server[$key]; - } - unset($server); - - return $return; - } - - /** - * Set a server value. - * - * @param float|int|string $key - * @param mixed $value - */ - public function setServerValue($key, $value) - { - if ($this->_immutable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception( - 'The User-Agent device object has already been retrieved; the server array is now immutable' - ); - } - - $server = $this->getServer(); // ensure it's been initialized - $key = strtolower($key); - $this->_server[$key] = $value; - - return $this; - } - - /** - * Set plugin loader. - * - * @param string $type Type of plugin loader; one of 'storage', (?) - * @param string|Zend_Loader_PluginLoader $loader - * - * @return Zend_Http_UserAgent - */ - public function setPluginLoader($type, $loader) - { - $prefix = null; - $path = null; - $type = $this->_validateLoaderType($type); - - if (is_string($loader)) { - if (!class_exists($loader)) { - require_once 'Zend/Loader.php'; - Zend_Loader::loadClass($loader); - } - $loader = new $loader(); - } elseif (!is_object($loader)) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Expected a plugin loader class or object; received %s', - gettype($loader) - )); - } - if (!$loader instanceof Zend_Loader_PluginLoader) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Expected an object extending Zend_Loader_PluginLoader; received %s', - get_class($loader) - )); - } - - $basePrefix = 'Zend_Http_UserAgent_'; - $basePath = 'Zend/Http/UserAgent/'; - switch ($type) { - case 'storage': - $prefix = $basePrefix . 'Storage'; - $path = $basePath . 'Storage'; - - break; - case 'device': - $prefix = $basePrefix; - $path = $basePath; - - break; - } - $loader->addPrefixPath($prefix, $path); - $this->_loaders[$type] = $loader; - - return $this; - } - - /** - * Get a plugin loader. - * - * @param string $type A valid plugin loader type; see {@link $_loaderTypes} - * - * @return Zend_Loader_PluginLoader - */ - public function getPluginLoader($type) - { - $type = $this->_validateLoaderType($type); - if (!isset($this->_loaders[$type])) { - require_once 'Zend/Loader/PluginLoader.php'; - $this->setPluginLoader($type, new Zend_Loader_PluginLoader()); - } - - return $this->_loaders[$type]; - } - - /** - * Validate a plugin loader type. - * - * Verifies that it is in {@link $_loaderTypes}, and returns a normalized - * version of the type. - * - * @param string $type - * - * @return string - */ - protected function _validateLoaderType($type) - { - $type = strtolower($type); - if (!in_array($type, $this->_loaderTypes)) { - $types = implode(', ', $this->_loaderTypes); - - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Expected one of "%s" for plugin loader type; received "%s"', - $types, - (string) $type - )); - } - - return $type; - } - - /** - * Run the identification sequence to match the right browser type according to the - * user agent. - * - * @return Zend_Http_UserAgent_Result - */ - protected function _matchUserAgent() - { - $type = self::DEFAULT_BROWSER_TYPE; - - // If we have no identification sequence, just return the default type - if (empty($this->_config['identification_sequence'])) { - return $type; - } - - // Get sequence against which to match - $sequence = explode(',', $this->_config['identification_sequence']); - - // If a browser type is already configured, push that to the front of the list - if (null !== ($browserType = $this->getBrowserType())) { - array_unshift($sequence, $browserType); - } - - // Append the default browser type to the list if not alread in the list - if (!in_array($type, $sequence)) { - $sequence[] = $type; - } - - // Test each type until we find a match - foreach ($sequence as $browserType) { - $browserType = trim($browserType); - $className = $this->_getUserAgentDevice($browserType); - - // Attempt to match this device class - if ($this->_match($className)) { - $type = $browserType; - $this->_browserTypeClass[$type] = $className; - - break; - } - } - - return $type; - } - - /** - * Creates device object instance. - */ - protected function _createDevice() - { - $browserType = $this->getBrowserType(); - $classname = $this->_getUserAgentDevice($browserType); - $this->_device = new $classname($this->getUserAgent(), $this->getServer(), $this->getConfig()); - } -} diff --git a/library/Zend/Http/UserAgent/AbstractDevice.php b/library/Zend/Http/UserAgent/AbstractDevice.php deleted file mode 100644 index 134f32ead..000000000 --- a/library/Zend/Http/UserAgent/AbstractDevice.php +++ /dev/null @@ -1,1005 +0,0 @@ -_restoreFromArray($userAgent); - } else { - // Constructing new object - $this->setUserAgent($userAgent); - $this->_server = $server; - $this->_config = $config; - $this->_getDefaultFeatures(); - $this->_defineFeatures(); - } - } - - /** - * Serialize object. - * - * @return string - */ - public function serialize() - { - $spec = $this->__serialize(); - - return serialize($spec); - } - - public function __serialize(): array - { - return [ - '_aFeatures' => $this->_aFeatures, - '_aGroup' => $this->_aGroup, - '_browser' => $this->_browser, - '_browserVersion' => $this->_browserVersion, - '_userAgent' => $this->_userAgent, - '_images' => $this->_images, - ]; - } - - /** - * Unserialize. - * - * @param string $serialized - */ - public function unserialize($serialized) - { - $spec = unserialize($serialized); - $this->__unserialize($spec); - } - - public function __unserialize(array $data): void - { - $this->_restoreFromArray($data); - } - - /** - * Restore object state from array. - */ - protected function _restoreFromArray(array $spec) - { - foreach ($spec as $key => $value) { - if (property_exists($this, $key)) { - $this->{$key} = $value; - } - } - } - - /** - * Look for features. - * - * @return null|array - */ - protected function _defineFeatures() - { - $features = $this->_loadFeaturesAdapter(); - - if (is_array($features)) { - $this->_aFeatures = array_merge($this->_aFeatures, $features); - } - - return $this->_aFeatures; - } - - /** - * Gets the browser type identifier. - * - * @return string - */ - abstract public function getType(); - - /** - * Check a feature for the current browser/device. - * - * @param string $feature the feature to check - * - * @return bool - */ - public function hasFeature($feature) - { - return isset($this->_aFeatures[$feature]) && !is_null($this->_aFeatures[$feature]); - } - - /** - * Gets the value of the current browser/device feature. - * - * @param string $feature Feature to search - * - * @return null|string - */ - public function getFeature($feature) - { - if ($this->hasFeature($feature)) { - return $this->_aFeatures[$feature]; - } - } - - /** - * Set a feature for the current browser/device. - * - * @param string $feature the feature to set - * @param string $value (option) feature value - * @param string $group (option) Group to associate with the feature - * - * @return Zend_Http_UserAgent_AbstractDevice - */ - public function setFeature($feature, $value = false, $group = '') - { - $this->_aFeatures[$feature] = $value; - if (!empty($group)) { - $this->setGroup($group, $feature); - } - - return $this; - } - - /** - * Affects a feature to a group. - * - * @param string $group Group name - * @param string $feature Feature name - * - * @return Zend_Http_UserAgent_AbstractDevice - */ - public function setGroup($group, $feature) - { - if (!isset($this->_aGroup[$group])) { - $this->_aGroup[$group] = []; - } - if (!in_array($feature, $this->_aGroup[$group])) { - $this->_aGroup[$group][] = $feature; - } - - return $this; - } - - /** - * Gets an array of features associated to a group. - * - * @param string $group Group param - * - * @return array - */ - public function getGroup($group) - { - return $this->_aGroup[$group]; - } - - /** - * Gets all the browser/device features. - * - * @return array - */ - public function getAllFeatures() - { - return $this->_aFeatures; - } - - /** - * Gets all the browser/device features' groups. - * - * @return array - */ - public function getAllGroups() - { - return $this->_aGroup; - } - - /** - * Sets all the standard features extracted from the User Agent chain and $this->_server - * vars. - */ - protected function _getDefaultFeatures() - { - $server = []; - - // gets info from user agent chain - $uaExtract = static::extractFromUserAgent($this->getUserAgent()); - - if (is_array($uaExtract)) { - foreach ($uaExtract as $key => $info) { - $this->setFeature($key, $info, 'product_info'); - } - } - - if (isset($uaExtract['browser_name'])) { - $this->_browser = $uaExtract['browser_name']; - } - if (isset($uaExtract['browser_version'])) { - $this->_browserVersion = $uaExtract['browser_version']; - } - if (isset($uaExtract['device_os'])) { - $this->device_os = $uaExtract['device_os_name']; - } - - // browser & device info - $this->setFeature('is_wireless_device', false, 'product_info'); - $this->setFeature('is_mobile', false, 'product_info'); - $this->setFeature('is_desktop', false, 'product_info'); - $this->setFeature('is_tablet', false, 'product_info'); - $this->setFeature('is_bot', false, 'product_info'); - $this->setFeature('is_email', false, 'product_info'); - $this->setFeature('is_text', false, 'product_info'); - $this->setFeature('device_claims_web_support', false, 'product_info'); - - $this->setFeature('is_' . strtolower($this->getType()), true, 'product_info'); - - // sets the browser name - if (isset($this->list) && empty($this->_browser)) { - $lowerUserAgent = strtolower($this->getUserAgent()); - foreach ($this->list as $browser_signature) { - if (strpos($lowerUserAgent, (string) $browser_signature) !== false) { - $this->_browser = strtolower($browser_signature); - $this->setFeature('browser_name', $this->_browser, 'product_info'); - } - } - } - - // sets the client IP - if (isset($this->_server['remote_addr'])) { - $this->setFeature('client_ip', $this->_server['remote_addr'], 'product_info'); - } elseif (isset($this->_server['http_x_forwarded_for'])) { - $this->setFeature('client_ip', $this->_server['http_x_forwarded_for'], 'product_info'); - } elseif (isset($this->_server['http_client_ip'])) { - $this->setFeature('client_ip', $this->_server['http_client_ip'], 'product_info'); - } - - // sets the server infos - if (isset($this->_server['server_software'])) { - if (strpos($this->_server['server_software'], 'Apache') !== false || strpos($this->_server['server_software'], 'LiteSpeed') !== false) { - $server['version'] = 1; - if (strpos($this->_server['server_software'], 'Apache/2') !== false) { - $server['version'] = 2; - } - $server['server'] = 'apache'; - } - - if (strpos($this->_server['server_software'], 'Microsoft-IIS') !== false) { - $server['server'] = 'iis'; - } - - if (strpos($this->_server['server_software'], 'Unix') !== false) { - $server['os'] = 'unix'; - if (isset($_ENV['MACHTYPE'])) { - if (strpos($_ENV['MACHTYPE'], 'linux') !== false) { - $server['os'] = 'linux'; - } - } - } elseif (strpos($this->_server['server_software'], 'Win') !== false) { - $server['os'] = 'windows'; - } - - if (preg_match('/Apache\/([0-9\.]*)/', $this->_server['server_software'], $arr)) { - if ($arr[1]) { - $server['version'] = $arr[1]; - $server['server'] = 'apache'; - } - } - } - - $this->setFeature('php_version', phpversion(), 'server_info'); - if (isset($server['server'])) { - $this->setFeature('server_os', $server['server'], 'server_info'); - } - if (isset($server['version'])) { - $this->setFeature('server_os_version', $server['version'], 'server_info'); - } - if (isset($this->_server['http_accept'])) { - $this->setFeature('server_http_accept', $this->_server['http_accept'], 'server_info'); - } - if (isset($this->_server['http_accept_language'])) { - $this->setFeature('server_http_accept_language', $this->_server['http_accept_language'], 'server_info'); - } - if (isset($this->_server['server_addr'])) { - $this->setFeature('server_ip', $this->_server['server_addr'], 'server_info'); - } - if (isset($this->_server['server_name'])) { - $this->setFeature('server_name', $this->_server['server_name'], 'server_info'); - } - } - - /** - * Extract and sets informations from the User Agent chain. - * - * @param string $userAgent User Agent chain - * - * @return array - */ - public static function extractFromUserAgent($userAgent) - { - $result = []; - $real = []; - $compatibility = []; - $userAgent = trim($userAgent); - - /** - * @see http://www.texsoft.it/index.php?c=software&m=sw.php.useragent&l=it - */ - $pattern = "(([^/\s]*)(/(\S*))?)(\s*\[[a-zA-Z][a-zA-Z]\])?\s*(\\((([^()]|(\\([^()]*\\)))*)\\))?\s*"; - preg_match("#^$pattern#", $userAgent, $match); - - $comment = []; - if (isset($match[7])) { - $comment = explode(';', $match[7]); - } - - // second part if exists - $end = substr($userAgent, strlen($match[0])); - if (!empty($end)) { - $result['others']['full'] = $end; - } - - $match2 = []; - if (isset($result['others'])) { - preg_match_all('/(([^\/\s]*)(\/)?([^\/\(\)\s]*)?)(\s\((([^\)]*)*)\))?/i', $result['others']['full'], $match2); - } - $result['user_agent'] = trim($match[1]); - $result['product_name'] = isset($match[2]) ? trim($match[2]) : ''; - $result['browser_name'] = $result['product_name']; - if (isset($match[4]) && trim($match[4])) { - $result['product_version'] = trim($match[4]); - $result['browser_version'] = trim($match[4]); - } - if (count($comment) && !empty($comment[0])) { - $result['comment']['full'] = trim($match[7]); - $result['comment']['detail'] = $comment; - $result['compatibility_flag'] = trim($comment[0]); - if (isset($comment[1])) { - $result['browser_token'] = trim($comment[1]); - } - if (isset($comment[2])) { - $result['device_os_token'] = trim($comment[2]); - } - } - if (empty($result['device_os_token']) && !empty($result['compatibility_flag'])) { - // some browsers do not have a platform token - $result['device_os_token'] = $result['compatibility_flag']; - } - if ($match2) { - $i = 0; - $max = is_countable($match2[0]) ? count($match2[0]) : 0; - for ($i = 0; $i < $max; ++$i) { - if (!empty($match2[0][$i])) { - $result['others']['detail'][] = [ - $match2[0][$i], - $match2[2][$i], - $match2[4][$i], - ]; - } - } - } - - /** Security level */ - $security = [ - 'N' => 'no security', - 'U' => 'strong security', - 'I' => 'weak security', - ]; - if (!empty($result['browser_token'])) { - if (isset($security[$result['browser_token']])) { - $result['security_level'] = $security[$result['browser_token']]; - unset($result['browser_token']); - } - } - - $product = strtolower($result['browser_name']); - - // Mozilla : true && false - $compatibleOrIe = false; - if (isset($result['compatibility_flag'], $result['comment'])) { - $compatibleOrIe = ($result['compatibility_flag'] == 'compatible' || strpos($result['comment']['full'], 'MSIE') !== false); - } - if ($product == 'mozilla' && $compatibleOrIe) { - if (!empty($result['browser_token'])) { - // Classic Mozilla chain - preg_match_all('/([^\/\s].*)(\/|\s)(.*)/i', $result['browser_token'], $real); - } else { - // MSIE specific chain with 'Windows' compatibility flag - foreach ($result['comment']['detail'] as $v) { - if (strpos($v, 'MSIE') !== false) { - $real[0][1] = trim($v); - $result['browser_engine'] = 'MSIE'; - $real[1][0] = 'Internet Explorer'; - $temp = explode(' ', trim($v)); - $real[3][0] = $temp[1]; - } - if (strpos($v, 'Win') !== false) { - $result['device_os_token'] = trim($v); - } - } - } - - if (!empty($real[0])) { - $result['browser_name'] = $real[1][0]; - $result['browser_version'] = $real[3][0]; - } else { - if (isset($result['browser_token'])) { - $result['browser_name'] = $result['browser_token']; - } - $result['browser_version'] = '??'; - } - } elseif ($product == 'mozilla' && isset($result['browser_version']) - && $result['browser_version'] < 5.0 - ) { - // handles the real Mozilla (or old Netscape if version < 5.0) - $result['browser_name'] = 'Netscape'; - } - - // windows - if ($result['browser_name'] == 'MSIE') { - $result['browser_engine'] = 'MSIE'; - $result['browser_name'] = 'Internet Explorer'; - } - if (isset($result['device_os_token'])) { - if (strpos($result['device_os_token'], 'Win') !== false) { - $windows = [ - 'Windows NT 6.1' => 'Windows 7', - 'Windows NT 6.0' => 'Windows Vista', - 'Windows NT 5.2' => 'Windows Server 2003', - 'Windows NT 5.1' => 'Windows XP', - 'Windows NT 5.01' => 'Windows 2000 SP1', - 'Windows NT 5.0' => 'Windows 2000', - 'Windows NT 4.0' => 'Microsoft Windows NT 4.0', - 'WinNT' => 'Microsoft Windows NT 4.0', - 'Windows 98; Win 9x 4.90' => 'Windows Me', - 'Windows 98' => 'Windows 98', - 'Win98' => 'Windows 98', - 'Windows 95' => 'Windows 95', - 'Win95' => 'Windows 95', - 'Windows CE' => 'Windows CE', - ]; - if (isset($windows[$result['device_os_token']])) { - $result['device_os_name'] = $windows[$result['device_os_token']]; - } else { - $result['device_os_name'] = $result['device_os_token']; - } - } - } - - // iphone - $apple_device = [ - 'iPhone', - 'iPod', - 'iPad', - ]; - if (isset($result['compatibility_flag'])) { - if (in_array($result['compatibility_flag'], $apple_device)) { - $result['device'] = strtolower($result['compatibility_flag']); - $result['device_os_token'] = 'iPhone OS'; - if (isset($comment[3])) { - $result['browser_language'] = trim($comment[3]); - } - if (isset($result['others']['detail'][1])) { - $result['browser_version'] = $result['others']['detail'][1][2]; - } elseif (isset($result['others']['detail']) && count($result['others']['detail'])) { - $result['browser_version'] = $result['others']['detail'][0][2]; - } - if (!empty($result['others']['detail'][2])) { - $result['firmware'] = $result['others']['detail'][2][2]; - } - if (!empty($result['others']['detail'][3])) { - $result['browser_name'] = $result['others']['detail'][3][1]; - $result['browser_build'] = $result['others']['detail'][3][2]; - } - } - } - - // Safari - if (isset($result['others'])) { - if ($result['others']['detail'][0][1] == 'AppleWebKit') { - $result['browser_engine'] = 'AppleWebKit'; - if (isset($result['others']['detail'][1]) && $result['others']['detail'][1][1] == 'Version') { - $result['browser_version'] = $result['others']['detail'][1][2]; - } else { - $result['browser_version'] = $result['others']['detail'][count($result['others']['detail']) - 1][2]; - } - if (isset($comment[3])) { - $result['browser_language'] = trim($comment[3]); - } - - $last = $result['others']['detail'][count($result['others']['detail']) - 1][1]; - - if (empty($result['others']['detail'][2][1]) || $result['others']['detail'][2][1] == 'Safari') { - if (isset($result['others']['detail'][1])) { - $result['browser_name'] = ($result['others']['detail'][1][1] && $result['others']['detail'][1][1] != 'Version' ? $result['others']['detail'][1][1] : 'Safari'); - $result['browser_version'] = ($result['others']['detail'][1][2] ?: $result['others']['detail'][0][2]); - } else { - $result['browser_name'] = ($result['others']['detail'][0][1] && $result['others']['detail'][0][1] != 'Version' ? $result['others']['detail'][0][1] : 'Safari'); - $result['browser_version'] = $result['others']['detail'][0][2]; - } - } else { - $result['browser_name'] = $result['others']['detail'][2][1]; - $result['browser_version'] = $result['others']['detail'][2][2]; - - // mobile version - if ($result['browser_name'] == 'Mobile') { - $result['browser_name'] = 'Safari ' . $result['browser_name']; - if ($result['others']['detail'][1][1] == 'Version') { - $result['browser_version'] = $result['others']['detail'][1][2]; - } - } - } - - // For Safari < 2.2, AppleWebKit version gives the Safari version - if (strpos($result['browser_version'], '.') > 2 || (int) $result['browser_version'] > 20) { - $temp = explode('.', $result['browser_version']); - $build = (int) $temp[0]; - $awkVersion = [ - 48 => '0.8', - 73 => '0.9', - 85 => '1.0', - 103 => '1.1', - 124 => '1.2', - 300 => '1.3', - 400 => '2.0', - ]; - foreach ($awkVersion as $k => $v) { - if ($build >= $k) { - $result['browser_version'] = $v; - } - } - } - } - - // Gecko (Firefox or compatible) - if ($result['others']['detail'][0][1] == 'Gecko') { - $searchRV = true; - if (!empty($result['others']['detail'][1][1]) && !empty($result['others']['detail'][count($result['others']['detail']) - 1][2]) || strpos(strtolower($result['others']['full']), 'opera') !== false) { - $searchRV = false; - $result['browser_engine'] = $result['others']['detail'][0][1]; - - // the name of the application is at the end indepenently - // of quantity of information in $result['others']['detail'] - $last = count($result['others']['detail']) - 1; - - // exception : if the version of the last information is - // empty we take the previous one - if (empty($result['others']['detail'][$last][2])) { - --$last; - } - - // exception : if the last one is 'Red Hat' or 'Debian' => - // use rv: to find browser_version */ - if (in_array($result['others']['detail'][$last][1], [ - 'Debian', - 'Hat', - ])) { - $searchRV = true; - } - $result['browser_name'] = $result['others']['detail'][$last][1]; - $result['browser_version'] = $result['others']['detail'][$last][2]; - if (isset($comment[4])) { - $result['browser_build'] = trim($comment[4]); - } - if (isset($comment[3])) { - $result['browser_language'] = trim($comment[3]); - } - - // Netscape - if ($result['browser_name'] == 'Navigator' || $result['browser_name'] == 'Netscape6') { - $result['browser_name'] = 'Netscape'; - } - } - if ($searchRV) { - // Mozilla alone : the version is identified by rv: - $result['browser_name'] = 'Mozilla'; - if (isset($result['comment']['detail'])) { - foreach ($result['comment']['detail'] as $rv) { - if (strpos($rv, 'rv:') !== false) { - $result['browser_version'] = trim(str_replace('rv:', '', $rv)); - } - } - } - } - } - - // Netscape - if ($result['others']['detail'][0][1] == 'Netscape') { - $result['browser_name'] = 'Netscape'; - $result['browser_version'] = $result['others']['detail'][0][2]; - } - - // Opera - // Opera: engine Presto - if ($result['others']['detail'][0][1] == 'Presto') { - $result['browser_engine'] = 'Presto'; - if (!empty($result['others']['detail'][1][2])) { - $result['browser_version'] = $result['others']['detail'][1][2]; - } - } - - // UA ends with 'Opera X.XX' or 'Opera/X.XX' - if ($result['others']['detail'][0][1] == 'Opera') { - $result['browser_name'] = $result['others']['detail'][0][1]; - // Opera X.XX - if (isset($result['others']['detail'][1][1])) { - $result['browser_version'] = $result['others']['detail'][1][1]; - // Opera/X.XX - } elseif (isset($result['others']['detail'][0][2])) { - $result['browser_version'] = $result['others']['detail'][0][2]; - } - } - - // Opera Mini - if (isset($result['browser_token'])) { - if (strpos($result['browser_token'], 'Opera Mini') !== false) { - $result['browser_name'] = 'Opera Mini'; - } - } - - // Symbian - if ($result['others']['detail'][0][1] == 'SymbianOS') { - $result['device_os_token'] = 'SymbianOS'; - } - } - - // UA ends with 'Opera X.XX' - if (isset($result['browser_name'], $result['browser_engine'])) { - if ($result['browser_name'] == 'Opera' && $result['browser_engine'] == 'Gecko' && empty($result['browser_version'])) { - $result['browser_version'] = $result['others']['detail'][count($result['others']['detail']) - 1][1]; - } - } - - // cleanup - if (isset($result['browser_version'], $result['browser_build'])) { - if ($result['browser_version'] == $result['browser_build']) { - unset($result['browser_build']); - } - } - - // compatibility - $compatibility['AppleWebKit'] = 'Safari'; - $compatibility['Gecko'] = 'Firefox'; - $compatibility['MSIE'] = 'Internet Explorer'; - $compatibility['Presto'] = 'Opera'; - if (!empty($result['browser_engine'])) { - if (isset($compatibility[$result['browser_engine']])) { - $result['browser_compatibility'] = $compatibility[$result['browser_engine']]; - } - } - - ksort($result); - - return $result; - } - - /** - * Loads the Features Adapter if it's defined in the $config array - * Otherwise, nothing is done. - * - * @return array - */ - protected function _loadFeaturesAdapter() - { - $config = $this->_config; - $browserType = $this->getType(); - if (!isset($config[$browserType]) || !isset($config[$browserType]['features'])) { - return []; - } - $config = $config[$browserType]['features']; - - if (empty($config['classname'])) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "classname" config parameter defined'); - } - - $className = $config['classname']; - if (!class_exists($className)) { - if (isset($config['path'])) { - $path = $config['path']; - } else { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "path" config parameter defined'); - } - - if (false === include_once($path)) { - require_once 'Zend/Http/UserAgent/Exception.php'; - - throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter path that does not exist'); - } - } - - return call_user_func([$className, 'getFromRequest'], $this->_server, $this->_config); - } - - /** - * Retrieve image format support. - * - * @return array - */ - public function getImageFormatSupport() - { - return $this->_images; - } - - /** - * Get maximum image height supported by this device. - * - * @return int - */ - public function getMaxImageHeight() - { - return null; - } - - /** - * Get maximum image width supported by this device. - * - * @return int - */ - public function getMaxImageWidth() - { - return null; - } - - /** - * Get physical screen height of this device. - * - * @return int - */ - public function getPhysicalScreenHeight() - { - return null; - } - - /** - * Get physical screen width of this device. - * - * @return int - */ - public function getPhysicalScreenWidth() - { - return null; - } - - /** - * Get preferred markup type. - * - * @return string - */ - public function getPreferredMarkup() - { - return 'xhtml'; - } - - /** - * Get supported X/HTML version. - * - * @return int - */ - public function getXhtmlSupportLevel() - { - return 4; - } - - /** - * Does the device support Flash? - * - * @return bool - */ - public function hasFlashSupport() - { - return true; - } - - /** - * Does the device support PDF? - * - * @return bool - */ - public function hasPdfSupport() - { - return true; - } - - /** - * Does the device have a phone number associated with it? - * - * @return bool - */ - public function hasPhoneNumber() - { - return false; - } - - /** - * Does the device support HTTPS? - * - * @return bool - */ - public function httpsSupport() - { - return true; - } - - /** - * Get the browser type. - * - * @return string - */ - public function getBrowser() - { - return $this->_browser; - } - - /** - * Get the browser version. - * - * @return string - */ - public function getBrowserVersion() - { - return $this->_browserVersion; - } - - /** - * Get the user agent string. - * - * @return string - */ - public function getUserAgent() - { - return $this->_userAgent; - } - - /** - * @return the $_images - */ - public function getImages() - { - return $this->_images; - } - - /** - * @param string $browser - */ - public function setBrowser($browser) - { - $this->_browser = $browser; - } - - /** - * @param string $browserVersion - */ - public function setBrowserVersion($browserVersion) - { - $this->_browserVersion = $browserVersion; - } - - /** - * @param string $userAgent - */ - public function setUserAgent($userAgent) - { - $this->_userAgent = $userAgent; - - return $this; - } - - /** - * @param array $_images - */ - public function setImages($_images) - { - $this->_images = $_images; - } - - /** - * Match a user agent string against a list of signatures. - * - * @param string $userAgent - * @param array $signatures - * - * @return bool - */ - protected static function _matchAgentAgainstSignatures($userAgent, $signatures) - { - $userAgent = strtolower($userAgent); - foreach ($signatures as $signature) { - if (!empty($signature)) { - if (strpos($userAgent, (string) $signature) !== false) { - // Browser signature was found in user agent string - return true; - } - } - } - - return false; - } -} diff --git a/library/Zend/Http/UserAgent/Bot.php b/library/Zend/Http/UserAgent/Bot.php deleted file mode 100644 index bb77b384b..000000000 --- a/library/Zend/Http/UserAgent/Bot.php +++ /dev/null @@ -1,121 +0,0 @@ - $value) { - // For a few keys, we need to munge a bit for the device object - switch ($key) { - case 'browser': - $features['mobile_browser'] = $value; - - break; - - case 'version': - $features['mobile_browser_version'] = $value; - - break; - - case 'platform': - $features['device_os'] = $value; - - break; - - default: - $features[$key] = $value; - - break; - } - } - } - - return $features; - } -} diff --git a/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php b/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php deleted file mode 100644 index 9bc6e0efb..000000000 --- a/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php +++ /dev/null @@ -1,76 +0,0 @@ -getDeviceCapabilitiesFromRequest(array_change_key_case($request, CASE_UPPER)); - - return self::getAllCapabilities($wurflObj); - } - - /*** - * Builds an array with all capabilities - * - * @param TeraWurfl $wurflObj TeraWurfl object - */ - public static function getAllCapabilities(TeraWurfl $wurflObj) - { - $features = []; - foreach ($wurflObj->capabilities as $group) { - if (!is_array($group)) { - continue; - } - foreach ($group as $key => $value) { - if (is_bool($value)) { - // to have the same type than the official WURFL API - $features[$key] = ($value ? 'true' : 'false'); - } else { - $features[$key] = $value; - } - } - } - - return $features; - } -} diff --git a/library/Zend/Http/UserAgent/Features/Exception.php b/library/Zend/Http/UserAgent/Features/Exception.php deleted file mode 100644 index 9692f8440..000000000 --- a/library/Zend/Http/UserAgent/Features/Exception.php +++ /dev/null @@ -1,29 +0,0 @@ -setFeature('iframes', false, 'product_capability'); - $this->setFeature('frames', false, 'product_capability'); - $this->setFeature('javascript', false, 'product_capability'); - - return parent::_defineFeatures(); - } -} diff --git a/library/Zend/Http/UserAgent/Mobile.php b/library/Zend/Http/UserAgent/Mobile.php deleted file mode 100644 index 773649c04..000000000 --- a/library/Zend/Http/UserAgent/Mobile.php +++ /dev/null @@ -1,533 +0,0 @@ -setFeature('is_wireless_device', false, 'product_info'); - - parent::_defineFeatures(); - - if (isset($this->_aFeatures['mobile_browser'])) { - $this->setFeature('browser_name', $this->_aFeatures['mobile_browser']); - $this->_browser = $this->_aFeatures['mobile_browser']; - } - if (isset($this->_aFeatures['mobile_browser_version'])) { - $this->setFeature('browser_version', $this->_aFeatures['mobile_browser_version']); - $this->_browserVersion = $this->_aFeatures['mobile_browser_version']; - } - - // markup - if ($this->getFeature('device_os') == 'iPhone OS' - || $this->getFeature('device_os_token') == 'iPhone OS' - ) { - $this->setFeature('markup', 'iphone'); - } else { - $this->setFeature('markup', $this->getMarkupLanguage($this->getFeature('preferred_markup'))); - } - - // image format - $this->_images = []; - - if ($this->getFeature('png')) { - $this->_images[] = 'png'; - } - if ($this->getFeature('jpg')) { - $this->_images[] = 'jpg'; - } - if ($this->getFeature('gif')) { - $this->_images[] = 'gif'; - } - if ($this->getFeature('wbmp')) { - $this->_images[] = 'wbmp'; - } - - return $this->_aFeatures; - } - - /** - * Determine markup language expected. - * - * @param null|mixed $preferredMarkup - * - * @return __TYPE__ - */ - public function getMarkupLanguage($preferredMarkup = null) - { - $return = ''; - switch ($preferredMarkup) { - case 'wml_1_1': - case 'wml_1_2': - case 'wml_1_3': - $return = 'wml'; //text/vnd.wap.wml encoding="ISO-8859-15" - // no break - case 'html_wi_imode_compact_generic': - case 'html_wi_imode_html_1': - case 'html_wi_imode_html_2': - case 'html_wi_imode_html_3': - case 'html_wi_imode_html_4': - case 'html_wi_imode_html_5': - $return = 'chtml'; //text/html - // no break - case 'html_wi_oma_xhtmlmp_1_0': //application/vnd.wap.xhtml+xml - case 'html_wi_w3_xhtmlbasic': //application/xhtml+xml DTD XHTML Basic 1.0 - $return = 'xhtml'; - // no break - case 'html_web_3_2': //text/html DTD Html 3.2 Final - case 'html_web_4_0': //text/html DTD Html 4.01 Transitional - $return = ''; - } - - return $return; - } - - /** - * Determine image format support. - * - * @return array - */ - public function getImageFormatSupport() - { - return $this->_images; - } - - /** - * Determine maximum image height supported. - * - * @return int - */ - public function getMaxImageHeight() - { - return $this->getFeature('max_image_height'); - } - - /** - * Determine maximum image width supported. - * - * @return int - */ - public function getMaxImageWidth() - { - return $this->getFeature('max_image_width'); - } - - /** - * Determine physical screen height. - * - * @return int - */ - public function getPhysicalScreenHeight() - { - return $this->getFeature('physical_screen_height'); - } - - /** - * Determine physical screen width. - * - * @return int - */ - public function getPhysicalScreenWidth() - { - return $this->getFeature('physical_screen_width'); - } - - /** - * Determine preferred markup. - * - * @return string - */ - public function getPreferredMarkup() - { - return $this->getFeature('markup'); - } - - /** - * Determine X/HTML support level. - * - * @return int - */ - public function getXhtmlSupportLevel() - { - return $this->getFeature('xhtml_support_level'); - } - - /** - * Does the device support Flash? - * - * @return bool - */ - public function hasFlashSupport() - { - return $this->getFeature('fl_browser'); - } - - /** - * Does the device support PDF? - * - * @return bool - */ - public function hasPdfSupport() - { - return $this->getFeature('pdf_support'); - } - - /** - * Does the device have an associated phone number? - * - * @return bool - */ - public function hasPhoneNumber() - { - return $this->getFeature('can_assign_phone_number'); - } - - /** - * Does the device support HTTPS? - * - * @return bool - */ - public function httpsSupport() - { - return $this->getFeature('https_support') == 'supported'; - } -} diff --git a/library/Zend/Http/UserAgent/Offline.php b/library/Zend/Http/UserAgent/Offline.php deleted file mode 100644 index 8858e9f0b..000000000 --- a/library/Zend/Http/UserAgent/Offline.php +++ /dev/null @@ -1,63 +0,0 @@ -setFeature('images', false, 'product_capability'); - $this->setFeature('iframes', false, 'product_capability'); - $this->setFeature('frames', false, 'product_capability'); - $this->setFeature('javascript', false, 'product_capability'); - - return parent::_defineFeatures(); - } -} diff --git a/library/Zend/Http/UserAgent/Spam.php b/library/Zend/Http/UserAgent/Spam.php deleted file mode 100644 index da049220e..000000000 --- a/library/Zend/Http/UserAgent/Spam.php +++ /dev/null @@ -1,73 +0,0 @@ -setFeature('images', false, 'product_capability'); - $this->setFeature('iframes', false, 'product_capability'); - $this->setFeature('frames', false, 'product_capability'); - $this->setFeature('javascript', false, 'product_capability'); - - return parent::_defineFeatures(); - } -} diff --git a/library/Zend/Http/UserAgent/Storage.php b/library/Zend/Http/UserAgent/Storage.php deleted file mode 100644 index 5034e057a..000000000 --- a/library/Zend/Http/UserAgent/Storage.php +++ /dev/null @@ -1,50 +0,0 @@ -_data); - } - - /** - * Returns the contents of storage. - * - * Behavior is undefined when storage is empty. - * - * @return mixed - */ - public function read() - { - return $this->_data; - } - - /** - * Writes $contents to storage. - * - * @param mixed $contents - */ - public function write($contents) - { - $this->_data = $contents; - } - - /** - * Clears contents from storage. - */ - public function clear() - { - $this->_data = null; - } -} diff --git a/library/Zend/Http/UserAgent/Storage/Session.php b/library/Zend/Http/UserAgent/Storage/Session.php deleted file mode 100644 index 9f3f7ced8..000000000 --- a/library/Zend/Http/UserAgent/Storage/Session.php +++ /dev/null @@ -1,154 +0,0 @@ -toArray(); - } elseif (is_object($options)) { - $options = (array) $options; - } - if (null !== $options && !is_array($options)) { - require_once 'Zend/Http/UserAgent/Storage/Exception.php'; - - throw new Zend_Http_UserAgent_Storage_Exception(sprintf( - 'Expected array or object options; "%s" provided', - gettype($options) - )); - } - - // add '.' to prevent the message ''Session namespace must not start with a number' - $this->_namespace = '.' - . ($options['browser_type'] ?? self::NAMESPACE_DEFAULT); - $this->_member = $options['member'] ?? self::MEMBER_DEFAULT; - $this->_session = new Zend_Session_Namespace($this->_namespace); - } - - /** - * Returns the session namespace name. - * - * @return string - */ - public function getNamespace() - { - return $this->_namespace; - } - - /** - * Returns the name of the session object member. - * - * @return string - */ - public function getMember() - { - return $this->_member; - } - - /** - * Defined by Zend_Http_UserAgent_Storage. - * - * @return bool - */ - public function isEmpty() - { - return empty($this->_session->{$this->_member}); - } - - /** - * Defined by Zend_Http_UserAgent_Storage. - * - * @return mixed - */ - public function read() - { - return $this->_session->{$this->_member}; - } - - /** - * Defined by Zend_Http_UserAgent_Storage. - * - * @param mixed $content - */ - public function write($content) - { - $this->_session->{$this->_member} = $content; - } - - /** - * Defined by Zend_Http_UserAgent_Storage. - */ - public function clear() - { - unset($this->_session->{$this->_member}); - } -} diff --git a/library/Zend/Http/UserAgent/Text.php b/library/Zend/Http/UserAgent/Text.php deleted file mode 100644 index fec83c31e..000000000 --- a/library/Zend/Http/UserAgent/Text.php +++ /dev/null @@ -1,123 +0,0 @@ -setFeature('images', false, 'product_capability'); - $this->setFeature('iframes', false, 'product_capability'); - $this->setFeature('frames', false, 'product_capability'); - $this->setFeature('javascript', false, 'product_capability'); - - return parent::_defineFeatures(); - } - - /** - * Determine supported image formats. - */ - public function getImageFormatSupport() - { - return null; - } - - /** - * Get preferred markup format. - * - * @return string - */ - public function getPreferredMarkup() - { - return 'xhtml'; - } - - /** - * Get supported X/HTML markup level. - * - * @return int - */ - public function getXhtmlSupportLevel() - { - return 1; - } - - /** - * Does the device support Flash? - * - * @return bool - */ - public function hasFlashSupport() - { - return false; - } - - /** - * Does the device support PDF? - * - * @return bool - */ - public function hasPdfSupport() - { - return false; - } -} diff --git a/library/Zend/Http/UserAgent/Validator.php b/library/Zend/Http/UserAgent/Validator.php deleted file mode 100644 index 935722624..000000000 --- a/library/Zend/Http/UserAgent/Validator.php +++ /dev/null @@ -1,66 +0,0 @@ -= 5.3 } elseif (($jsonLastErr = json_last_error()) != JSON_ERROR_NONE) { - require_once 'Zend/Json/Exception.php'; switch ($jsonLastErr) { case JSON_ERROR_DEPTH: throw new Zend_Json_Exception('Decoding failed: Maximum stack depth exceeded'); @@ -103,8 +99,6 @@ public static function decode($encodedValue, $objectDecodeType = Zend_Json::TYPE return $decode; } - require_once 'Zend/Json/Decoder.php'; - return Zend_Json_Decoder::decode($encodedValue, $objectDecodeType); } @@ -148,7 +142,6 @@ public static function encode($valueToEncode, $cycleCheck = false, $options = [] /** * @see Zend_Json_Encoder */ - require_once 'Zend/Json/Encoder.php'; $valueToEncode = self::_recursiveJsonExprFinder($valueToEncode, $javascriptExpressions); } @@ -156,7 +149,6 @@ public static function encode($valueToEncode, $cycleCheck = false, $options = [] if (function_exists('json_encode') && self::$useBuiltinEncoderDecoder !== true) { $encodedResult = json_encode($valueToEncode, JSON_THROW_ON_ERROR); } else { - require_once 'Zend/Json/Encoder.php'; $encodedResult = Zend_Json_Encoder::encode($valueToEncode, $cycleCheck, $options); } @@ -272,8 +264,6 @@ protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttribu // Keep an eye on how deeply we are involved in recursion. if ($recursionDepth > self::$maxRecursionDepthAllowed) { // XML tree is too deep. Exit now by throwing an exception. - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception( 'Function _processXml exceeded the allowed recursion depth of ' . self::$maxRecursionDepthAllowed); @@ -358,8 +348,6 @@ public static function fromXml($xmlStringContents, $ignoreXmlAttributes = true) // If it is not a valid XML content, throw an exception. if ($simpleXmlElementObject == null) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Function fromXml was called with an invalid XML formatted string.'); } // End of if ($simpleXmlElementObject == null) diff --git a/library/Zend/Json/Decoder.php b/library/Zend/Json/Decoder.php index f7718da3e..a82bd5005 100644 --- a/library/Zend/Json/Decoder.php +++ b/library/Zend/Json/Decoder.php @@ -1,4 +1,5 @@ _tokenValue)) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Missing key in object encoding: ' . $this->_source); } @@ -211,8 +201,6 @@ protected function _decodeObject() $tok = $this->_getNextToken(); if ($tok != self::COLON) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Missing ":" in object encoding: ' . $this->_source); } @@ -225,8 +213,6 @@ protected function _decodeObject() } if ($tok != self::COMMA) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Missing "," in object encoding: ' . $this->_source); } @@ -279,8 +265,6 @@ protected function _decodeArray() } if ($tok != self::COMMA) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Missing "," in array encoding: ' . $this->_source); } @@ -407,8 +391,6 @@ protected function _getNextToken() break; default: - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Illegal escape ' . "sequence '" . $chr . "'"); } @@ -464,16 +446,12 @@ protected function _getNextToken() if (is_numeric($datum)) { if (preg_match('/^0\d+$/', $datum)) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception("Octal notation not supported by JSON (value: $datum)"); } $val = intval($datum); $fVal = floatval($datum); $this->_tokenValue = ($val == $fVal ? $val : $fVal); } else { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception("Illegal number format: $datum"); } @@ -481,8 +459,6 @@ protected function _getNextToken() $this->_offset = $start + strlen($datum); } } else { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Illegal Token'); } diff --git a/library/Zend/Json/Encoder.php b/library/Zend/Json/Encoder.php index b98d1ed0c..40f66e8ec 100644 --- a/library/Zend/Json/Encoder.php +++ b/library/Zend/Json/Encoder.php @@ -1,4 +1,5 @@ _options['silenceCyclicalExceptions'] === true) { return '"* RECURSION (' . get_class($value) . ') *"'; } - require_once 'Zend/Json/Exception.php'; throw new Zend_Json_Exception( 'Cycles not supported in JSON encoding, cycle introduced by ' @@ -243,7 +243,6 @@ protected function _encodeDatum(&$value) /** * JSON encode a string value by escaping characters as necessary. * - * @param string& $value * @param mixed $string * * @return string @@ -394,8 +393,6 @@ public static function encodeClass($className, $package = '') { $cls = new ReflectionClass($className); if (!$cls->isInstantiable()) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception("$className must be instantiable"); } diff --git a/library/Zend/Json/Exception.php b/library/Zend/Json/Exception.php index 08d646ab3..5aa92c956 100644 --- a/library/Zend/Json/Exception.php +++ b/library/Zend/Json/Exception.php @@ -1,4 +1,5 @@ setConfig($options); } else { - require_once 'Zend/Layout/Exception.php'; - throw new Zend_Layout_Exception('Invalid option provided to constructor'); } } @@ -242,8 +241,6 @@ public function setOptions($options) if ($options instanceof Zend_Config) { $options = $options->toArray(); } elseif (!is_array($options)) { - require_once 'Zend/Layout/Exception.php'; - throw new Zend_Layout_Exception('setOptions() expects either an array or a Zend_Config object'); } @@ -270,11 +267,9 @@ protected function _initMvc() protected function _initPlugin() { $pluginClass = $this->getPluginClass(); - require_once 'Zend/Controller/Front.php'; $front = Zend_Controller_Front::getInstance(); if (!$front->hasPlugin($pluginClass)) { if (!class_exists($pluginClass)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($pluginClass); } $front->registerPlugin( @@ -291,10 +286,8 @@ protected function _initPlugin() protected function _initHelper() { $helperClass = $this->getHelperClass(); - require_once 'Zend/Controller/Action/HelperBroker.php'; if (!Zend_Controller_Action_HelperBroker::hasHelper('layout')) { if (!class_exists($helperClass)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($helperClass); } Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-90, new $helperClass($this)); @@ -321,7 +314,6 @@ public function setConfig(Zend_Config $config) protected function _initVarContainer() { if (null === $this->_container) { - require_once 'Zend/View/Helper/Placeholder/Registry.php'; $this->_container = Zend_View_Helper_Placeholder_Registry::getRegistry()->getContainer(self::class); } @@ -585,7 +577,6 @@ public function setPluginClass($pluginClass) public function getView() { if (null === $this->_view) { - require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); if (null === $viewRenderer->view) { $viewRenderer->initView(); @@ -664,7 +655,6 @@ public function setInflector(Zend_Filter_Inflector $inflector) public function getInflector() { if (null === $this->_inflector) { - require_once 'Zend/Filter/Inflector.php'; $inflector = new Zend_Filter_Inflector(); $inflector->setTargetReference($this->_inflectorTarget) ->addRules([':script' => ['Word_CamelCaseToDash', 'StringToLower']]) @@ -785,8 +775,6 @@ public function assign($spec, $value = null) return $this; } - require_once 'Zend/Layout/Exception.php'; - throw new Zend_Layout_Exception('Invalid values passed to assign()'); } diff --git a/library/Zend/Layout/Controller/Action/Helper/Layout.php b/library/Zend/Layout/Controller/Action/Helper/Layout.php index e90cbd531..b87199cc5 100644 --- a/library/Zend/Layout/Controller/Action/Helper/Layout.php +++ b/library/Zend/Layout/Controller/Action/Helper/Layout.php @@ -1,4 +1,5 @@ _frontController) { - /** - * @see Zend_Controller_Front - */ - require_once 'Zend/Controller/Front.php'; + // @see Zend_Controller_Front $this->_frontController = Zend_Controller_Front::getInstance(); } @@ -101,10 +97,7 @@ public function getFrontController() public function getLayoutInstance() { if (null === $this->_layout) { - /** - * @see Zend_Layout - */ - require_once 'Zend/Layout.php'; + // @see Zend_Layout if (null === ($this->_layout = Zend_Layout::getMvcInstance())) { $this->_layout = new Zend_Layout(); } @@ -174,8 +167,6 @@ public function __call($method, $args) return call_user_func_array([$layout, $method], $args); } - require_once 'Zend/Layout/Exception.php'; - throw new Zend_Layout_Exception(sprintf("Invalid method '%s' called on layout action helper", $method)); } } diff --git a/library/Zend/Layout/Controller/Plugin/Layout.php b/library/Zend/Layout/Controller/Plugin/Layout.php index f9492433c..965f73e69 100644 --- a/library/Zend/Layout/Controller/Plugin/Layout.php +++ b/library/Zend/Layout/Controller/Plugin/Layout.php @@ -1,4 +1,5 @@ setFallbackAutoloader(true); - if (\Zend_Loader::class != $class) { + if (Zend_Loader::class != $class) { self::loadClass($class); $methods = get_class_methods($class); if (!in_array('autoload', (array) $methods)) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception("The class \"$class\" does not have an autoload() method"); } @@ -283,8 +277,6 @@ protected static function _securityCheck($filename) { // Security check if (preg_match('/[^a-z0-9\\/\\\\_.:-]/i', $filename)) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception('Security check: Illegal character in filename'); } } diff --git a/library/Zend/Loader/Autoloader.php b/library/Zend/Loader/Autoloader.php index e6f7c7e2d..42261f3a8 100644 --- a/library/Zend/Loader/Autoloader.php +++ b/library/Zend/Loader/Autoloader.php @@ -1,4 +1,5 @@ toArray(); } if (!is_array($options)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Options must be passed to resource loader constructor'); } @@ -77,15 +75,12 @@ public function __construct($options) if ((null === $namespace) || (null === $this->getBasePath()) ) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Resource loader requires both a namespace and a base path for initialization'); } if (!empty($namespace)) { $namespace .= '_'; } - require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance()->unshiftAutoloader($this, $namespace); } @@ -114,13 +109,9 @@ public function __call($method, $args) if ('get' == substr($method, 0, 3)) { $type = strtolower(substr($method, 3)); if (!$this->hasResourceType($type)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception("Invalid resource type $type; cannot load resource"); } if (empty($args)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Cannot load resources; no resource specified'); } $resource = array_shift($args); @@ -128,8 +119,6 @@ public function __call($method, $args) return $this->load($resource, $type); } - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception("Method '$method' is not supported"); } @@ -293,8 +282,6 @@ public function addResourceType($type, $path, $namespace = null) $type = strtolower($type); if (!isset($this->_resourceTypes[$type])) { if (null === $namespace) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Initial definition of a resource type must include a namespace'); } $namespaceTopLevel = $this->getNamespace(); @@ -304,8 +291,6 @@ public function addResourceType($type, $path, $namespace = null) ]; } if (!is_string($path)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Invalid path specification provided; must be string'); } $this->_resourceTypes[$type]['path'] = $this->getBasePath() . '/' . rtrim($path, '\/'); @@ -345,13 +330,9 @@ public function addResourceTypes(array $types) { foreach ($types as $type => $spec) { if (!is_array($spec)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('addResourceTypes() expects an array of arrays'); } if (!isset($spec['path'])) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('addResourceTypes() expects each array to include a paths element'); } $paths = $spec['path']; @@ -474,14 +455,10 @@ public function load($resource, $type = null) if (null === $type) { $type = $this->getDefaultResourceType(); if (empty($type)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('No resource type specified'); } } if (!$this->hasResourceType($type)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Invalid resource type specified'); } $namespace = $this->_resourceTypes[$type]['namespace']; diff --git a/library/Zend/Loader/AutoloaderFactory.php b/library/Zend/Loader/AutoloaderFactory.php index 230c319e9..c846410e8 100644 --- a/library/Zend/Loader/AutoloaderFactory.php +++ b/library/Zend/Loader/AutoloaderFactory.php @@ -1,4 +1,5 @@ =')) { - if (!is_subclass_of($class, \Zend_Loader_SplAutoloader::class)) { + if (!is_subclass_of($class, Zend_Loader_SplAutoloader::class)) { require_once 'Exception/InvalidArgumentException.php'; throw new Zend_Loader_Exception_InvalidArgumentException(sprintf( diff --git a/library/Zend/Loader/ClassMapAutoloader.php b/library/Zend/Loader/ClassMapAutoloader.php index 1407db75c..345b4dfaf 100644 --- a/library/Zend/Loader/ClassMapAutoloader.php +++ b/library/Zend/Loader/ClassMapAutoloader.php @@ -1,4 +1,5 @@ $paths) { $message .= "\n$prefix: " . implode(PATH_SEPARATOR, $paths); } - require_once 'Zend/Loader/PluginLoader/Exception.php'; throw new Zend_Loader_PluginLoader_Exception($message); } @@ -474,18 +466,12 @@ public static function setIncludeFileCache($file) } if (!file_exists($file) && !file_exists(dirname($file))) { - require_once 'Zend/Loader/PluginLoader/Exception.php'; - throw new Zend_Loader_PluginLoader_Exception('Specified file does not exist and/or directory does not exist (' . $file . ')'); } if (file_exists($file) && !is_writable($file)) { - require_once 'Zend/Loader/PluginLoader/Exception.php'; - throw new Zend_Loader_PluginLoader_Exception('Specified file is not writeable (' . $file . ')'); } if (!file_exists($file) && file_exists(dirname($file)) && !is_writable(dirname($file))) { - require_once 'Zend/Loader/PluginLoader/Exception.php'; - throw new Zend_Loader_PluginLoader_Exception('Specified file is not writeable (' . $file . ')'); } diff --git a/library/Zend/Loader/PluginLoader/Exception.php b/library/Zend/Loader/PluginLoader/Exception.php index 20fa1ed6b..9e9ce255e 100644 --- a/library/Zend/Loader/PluginLoader/Exception.php +++ b/library/Zend/Loader/PluginLoader/Exception.php @@ -1,4 +1,5 @@ 100)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('Quality must be between 0.1 and 100'); } @@ -1198,8 +1195,6 @@ public static function setDefault($locale, $quality = 1) if (isset(self::$_localeData[$elocale[0]]) === true) { self::$_default = [$elocale[0] => $quality]; } else { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown locale '" . (string) $locale . "' can not be set as default!"); } } @@ -1222,8 +1217,6 @@ public static function getEnvironment() return self::$_environment; } - require_once 'Zend/Locale/Data/Translation.php'; - $language = setlocale(LC_ALL, 0); $languages = explode(';', $language); $languagearray = []; @@ -1456,7 +1449,6 @@ public function equals(Zend_Locale $object) */ public static function getTranslationList($path = null, $locale = null, $value = null) { - require_once 'Zend/Locale/Data.php'; $locale = self::findLocale($locale); $result = Zend_Locale_Data::getList($locale, $path, $value); if (empty($result) === true) { @@ -1543,7 +1535,6 @@ public static function getTerritoryTranslationList($locale = null) */ public static function getTranslation($value = null, $path = null, $locale = null) { - require_once 'Zend/Locale/Data.php'; $locale = self::findLocale($locale); $result = Zend_Locale_Data::getContent($locale, $path, $value); if (empty($result) === true && '0' !== $result) { @@ -1631,7 +1622,6 @@ public static function getTerritoryTranslation($value, $locale = null) */ public static function getQuestion($locale = null) { - require_once 'Zend/Locale/Data.php'; $locale = self::findLocale($locale); $quest = Zend_Locale_Data::getList($locale, 'question'); $yes = explode(':', $quest['yes']); @@ -1765,9 +1755,8 @@ public static function isLocale($locale, $strict = false, $compatible = true) public static function findLocale($locale = null) { if ($locale === null) { - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered(\Zend_Locale::class)) { - $locale = Zend_Registry::get(\Zend_Locale::class); + if (Zend_Registry::isRegistered(Zend_Locale::class)) { + $locale = Zend_Registry::get(Zend_Locale::class); } } @@ -1780,8 +1769,6 @@ public static function findLocale($locale = null) $locale = Zend_Locale::getLocaleToTerritory($locale); if (empty($locale)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("The locale '$locale' is no known locale"); } } else { @@ -1826,72 +1813,6 @@ public static function getLocaleList() return $list; } - /** - * Returns the set cache. - * - * @return Zend_Cache_Core The set cache - */ - public static function getCache() - { - require_once 'Zend/Locale/Data.php'; - - return Zend_Locale_Data::getCache(); - } - - /** - * Sets a cache. - * - * @param Zend_Cache_Core $cache Cache to set - */ - public static function setCache(Zend_Cache_Core $cache) - { - require_once 'Zend/Locale/Data.php'; - Zend_Locale_Data::setCache($cache); - } - - /** - * Returns true when a cache is set. - * - * @return bool - */ - public static function hasCache() - { - require_once 'Zend/Locale/Data.php'; - - return Zend_Locale_Data::hasCache(); - } - - /** - * Removes any set cache. - */ - public static function removeCache() - { - require_once 'Zend/Locale/Data.php'; - Zend_Locale_Data::removeCache(); - } - - /** - * Clears all set cache data. - * - * @param string $tag Tag to clear when the default tag name is not used - */ - public static function clearCache($tag = null) - { - require_once 'Zend/Locale/Data.php'; - Zend_Locale_Data::clearCache(); - } - - /** - * Disables the set cache. - * - * @param bool $flag True disables any set cache, default is false - */ - public static function disableCache($flag) - { - require_once 'Zend/Locale/Data.php'; - Zend_Locale_Data::disableCache($flag); - } - /** * Internal function, returns a single locale on detection. * @@ -1941,8 +1862,6 @@ private static function _prepareLocale($locale, $strict = false) // This can only happen when someone extends Zend_Locale and erases the default if ($locale === null) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('Autodetection of Locale has been failed!'); } diff --git a/library/Zend/Locale/Data.php b/library/Zend/Locale/Data.php index f27e922f1..01653ea4c 100644 --- a/library/Zend/Locale/Data.php +++ b/library/Zend/Locale/Data.php @@ -1,4 +1,5 @@ true], - []); - } - - $val = $value; - if (is_array($value)) { - $val = implode('_' , $value); - } - - $val = urlencode($val ?? ''); - $id = self::_filterCacheId('Zend_LocaleL_' . $locale . '_' . $path . '_' . $val); - if (!self::$_cacheDisabled && ($result = self::$_cache->load($id))) { - return unserialize($result); - } - $temp = []; switch (strtolower($path ?? '')) { case 'language': @@ -988,21 +948,11 @@ public static function getList($locale, $path, $value = false) break; default: - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown list ($path) for parsing locale data."); break; } - if (isset(self::$_cache)) { - if (self::$_cacheTags) { - self::$_cache->save(serialize($temp), $id, [\Zend_Locale::class]); - } else { - self::$_cache->save(serialize($temp), $id); - } - } - return $temp; } @@ -1020,25 +970,6 @@ public static function getContent($locale, $path, $value = false) $temp = []; $locale = self::_checkLocale($locale); - if (!isset(self::$_cache) && !self::$_cacheDisabled) { - require_once 'Zend/Cache.php'; - self::$_cache = Zend_Cache::factory( - 'Core', - 'File', - ['automatic_serialization' => true], - []); - } - - $val = $value; - if (is_array($value)) { - $val = implode('_' , $value); - } - $val = urlencode($val); - $id = self::_filterCacheId('Zend_LocaleC_' . $locale . '_' . $path . '_' . $val); - if (!self::$_cacheDisabled && ($result = self::$_cache->load($id))) { - return unserialize($result); - } - switch (strtolower($path ?? '')) { case 'language': $temp = self::_getFile($locale, '/ldml/localeDisplayNames/languages/language[@type=\'' . $value . '\']', 'type'); @@ -1605,8 +1536,6 @@ public static function getContent($locale, $path, $value = false) break; default: - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown detail ($path) for parsing locale data."); break; @@ -1615,117 +1544,7 @@ public static function getContent($locale, $path, $value = false) if (is_array($temp)) { $temp = current($temp); } - if (isset(self::$_cache)) { - if (self::$_cacheTags) { - self::$_cache->save(serialize($temp), $id, [\Zend_Locale::class]); - } else { - self::$_cache->save(serialize($temp), $id); - } - } return $temp; } - - /** - * Returns the set cache. - * - * @return Zend_Cache_Core The set cache - */ - public static function getCache() - { - return self::$_cache; - } - - /** - * Set a cache for Zend_Locale_Data. - * - * @param Zend_Cache_Core $cache A cache frontend - */ - public static function setCache(Zend_Cache_Core $cache) - { - self::$_cache = $cache; - self::_getTagSupportForCache(); - } - - /** - * Returns true when a cache is set. - * - * @return bool - */ - public static function hasCache() - { - if (self::$_cache !== null) { - return true; - } - - return false; - } - - /** - * Removes any set cache. - */ - public static function removeCache() - { - self::$_cache = null; - } - - /** - * Clears all set cache data. - */ - public static function clearCache() - { - if (self::$_cacheTags) { - self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, [\Zend_Locale::class]); - } else { - self::$_cache->clean(Zend_Cache::CLEANING_MODE_ALL); - } - } - - /** - * Disables the cache. - * - * @param bool $flag - */ - public static function disableCache($flag) - { - self::$_cacheDisabled = (boolean) $flag; - } - - /** - * Internal method to check if the given cache supports tags. - * - * @return bool - */ - private static function _getTagSupportForCache() - { - $backend = self::$_cache->getBackend(); - if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) { - $cacheOptions = $backend->getCapabilities(); - self::$_cacheTags = $cacheOptions['tags']; - } else { - self::$_cacheTags = false; - } - - return self::$_cacheTags; - } - - /** - * Filter an ID to only allow valid variable characters. - * - * @param string $value - * - * @return string - */ - protected static function _filterCacheId($value) - { - return strtr( - $value, - [ - '-' => '_', - '%' => '_', - '+' => '_', - '.' => '_', - ] - ); - } } diff --git a/library/Zend/Locale/Data/Translation.php b/library/Zend/Locale/Data/Translation.php index 32fe5afa4..95e8dd7f4 100644 --- a/library/Zend/Locale/Data/Translation.php +++ b/library/Zend/Locale/Data/Translation.php @@ -1,4 +1,5 @@ 'iso', 'fix_date' => false, 'locale' => null, - 'cache' => null, - 'disableCache' => null, 'precision' => null, ]; /** @@ -93,7 +91,6 @@ private static function _checkOptions(array $options = []) } $options['number_format'] = Zend_Locale_Data::getContent($locale, 'decimalnumber'); } elseif ((gettype($value) !== 'string') and ($value !== null)) { - require_once 'Zend/Locale/Exception.php'; $stringValue = (string) (is_array($value) ? implode(' ', $value) : $value); throw new Zend_Locale_Exception("Unknown number format type '" . gettype($value) . "'. " @@ -110,7 +107,6 @@ private static function _checkOptions(array $options = []) } $options['date_format'] = Zend_Locale_Format::getDateFormat($locale); } elseif ((gettype($value) !== 'string') and ($value !== null)) { - require_once 'Zend/Locale/Exception.php'; $stringValue = (string) (is_array($value) ? implode(' ', $value) : $value); throw new Zend_Locale_Exception("Unknown dateformat type '" . gettype($value) . "'. " @@ -126,8 +122,6 @@ private static function _checkOptions(array $options = []) case 'format_type' : if (($value != 'php') && ($value != 'iso')) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown date format type '$value'. Only 'iso' and 'php'" . ' are supported.'); } @@ -136,8 +130,6 @@ private static function _checkOptions(array $options = []) case 'fix_date' : if (($value !== true) && ($value !== false)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('Enabling correction of dates must be either true or false' . "(fix_date='$value')."); } @@ -149,36 +141,18 @@ private static function _checkOptions(array $options = []) break; - case 'cache' : - if ($value instanceof Zend_Cache_Core) { - Zend_Locale_Data::setCache($value); - } - - break; - - case 'disablecache' : - if (null !== $value) { - Zend_Locale_Data::disableCache($value); - } - - break; - case 'precision' : if ($value === null) { $value = -1; } if (($value < -1) || ($value > 30)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("'$value' precision is not a whole number less than 30."); } break; default: - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown option: '$name' = '$value'"); break; @@ -215,8 +189,6 @@ public static function convertNumerals($input, $from, $to = null) $from = strtolower($from); $source = Zend_Locale_Data::getContent('en', 'numberingsystem', $from); if (empty($source)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown script '$from'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9."); } @@ -224,8 +196,6 @@ public static function convertNumerals($input, $from, $to = null) $to = strtolower($to); $target = Zend_Locale_Data::getContent('en', 'numberingsystem', $to); if (empty($target)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown script '$to'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9."); } } else { @@ -264,8 +234,6 @@ public static function getNumber($input, array $options = []) } if (!self::isNumber($input, $options)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('No localized value in ' . $input . ' found, or the given number does not match the localized format'); } @@ -314,7 +282,6 @@ public static function getNumber($input, array $options = []) public static function toNumber($value, array $options = []) { // load class within method for speed - require_once 'Zend/Locale/Math.php'; $value = Zend_Locale_Math::floatalize($value); $value = Zend_Locale_Math::normalize($value); @@ -360,7 +327,6 @@ public static function toNumber($value, array $options = []) if (iconv_strpos($format, '0') === false) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception('Wrong format... missing 0'); } @@ -921,7 +887,6 @@ private static function _parseDate($date, $options) if (empty($parse)) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unknown date format, neither date nor time in '" . $format . "' found"); } @@ -942,7 +907,6 @@ private static function _parseDate($date, $options) if ((is_countable($splitted[0]) ? count($splitted[0]) : 0) == 0) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("No date part in '$date' found."); } @@ -1054,7 +1018,6 @@ private static function _parseDate($date, $options) or (isset($result['year']) and (iconv_strpos($date, $result['year']) === false)))) { if ($options['fix_date'] !== true) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unable to parse date '$date' using '" . $format . "' (false month, $position, $month)"); @@ -1071,10 +1034,9 @@ private static function _parseDate($date, $options) if ($result['day'] > 31) { if ($options['fix_date'] !== true) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unable to parse date '$date' using '" - . $format . "' (d <> y)"); + . $format . "' (d <> y)"); } $temp = $result['year']; $result['year'] = $result['day']; @@ -1088,10 +1050,9 @@ private static function _parseDate($date, $options) if ($result['month'] > 31) { if ($options['fix_date'] !== true) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unable to parse date '$date' using '" - . $format . "' (M <> y)"); + . $format . "' (M <> y)"); } $temp = $result['year']; $result['year'] = $result['month']; @@ -1105,10 +1066,9 @@ private static function _parseDate($date, $options) if ($result['month'] > 12) { if ($options['fix_date'] !== true || $result['month'] > 31) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unable to parse date '$date' using '" - . $format . "' (M <> d)"); + . $format . "' (M <> d)"); } $temp = $result['day']; $result['day'] = $result['month']; @@ -1176,8 +1136,6 @@ public static function getDateFormat($locale = null) { $format = Zend_Locale_Data::getContent($locale, 'date'); if (empty($format)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("failed to receive data from locale $locale"); } @@ -1211,8 +1169,7 @@ public static function getDate($date, array $options = []) /** * Returns if the given datestring contains all date parts from the given format. - * If no format is given, the default date format from the locale is used - * If you want to check if the date is a proper date you should use Zend_Date::isDate(). + * If no format is given, the default date format from the locale is used. * * @param string $date Date string * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details. @@ -1279,8 +1236,6 @@ public static function getTimeFormat($locale = null) { $format = Zend_Locale_Data::getContent($locale, 'time'); if (empty($format)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("failed to receive data from locale $locale"); } @@ -1322,8 +1277,6 @@ public static function getDateTimeFormat($locale = null) { $format = Zend_Locale_Data::getContent($locale, 'datetime'); if (empty($format)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("failed to receive data from locale $locale"); } diff --git a/library/Zend/Locale/Math.php b/library/Zend/Locale/Math.php index 8821177e1..9e6b37ec2 100644 --- a/library/Zend/Locale/Math.php +++ b/library/Zend/Locale/Math.php @@ -1,4 +1,5 @@ $precision)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("addition overflow: $op1 + $op2 != $result", $op1, $op2, $result); } @@ -89,8 +88,6 @@ public static function Sub($op1, $op2, $scale = null) $op2 = self::normalize($op2); $result = $op1 - $op2; if (is_infinite($result) or (abs($result + $op2 - $op1) > $precision)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("subtraction overflow: $op1 - $op2 != $result", $op1, $op2, $result); } @@ -112,8 +109,6 @@ public static function Pow($op1, $op2, $scale = null) $result = $op1 ** $op2; if (is_infinite($result) or is_nan($result)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("power overflow: $op1 ^ $op2", $op1, $op2, $result); } @@ -133,8 +128,6 @@ public static function Mul($op1, $op2, $scale = null) $op2 = self::normalize($op2); $result = $op1 * $op2; if (is_infinite($result) or is_nan($result)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("multiplication overflow: $op1 * $op2 != $result", $op1, $op2, $result); } @@ -148,8 +141,6 @@ public static function Div($op1, $op2, $scale = null) } if (empty($op2)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception('can not divide by zero', $op1, $op2, null); } if (empty($op1)) { @@ -159,8 +150,6 @@ public static function Div($op1, $op2, $scale = null) $op2 = self::normalize($op2); $result = $op1 / $op2; if (is_infinite($result) or is_nan($result)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("division overflow: $op1 / $op2 != $result", $op1, $op2, $result); } @@ -200,8 +189,6 @@ public static function Mod($op1, $op2) } $result = $op1 % $op2; if (is_nan($result) or (($op1 - $result) % $op2 != 0)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("modulus calculation error: $op1 % $op2 != $result", $op1, $op2, $result); } @@ -239,8 +226,6 @@ public static function Comp($op1, $op2, $scale = null) public static function Scale($scale) { if ($scale > 9) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("can not scale to precision $scale", $scale, null, null); } self::$defaultScale = $scale; diff --git a/library/Zend/Navigation.php b/library/Zend/Navigation.php index 2158e290c..848b4aca9 100644 --- a/library/Zend/Navigation.php +++ b/library/Zend/Navigation.php @@ -1,4 +1,5 @@ addPages($pages); } elseif (null !== $pages) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $pages must be an array, an ' . 'instance of Zend_Config, or null'); diff --git a/library/Zend/Navigation/Container.php b/library/Zend/Navigation/Container.php index 2a923373e..466a7db72 100644 --- a/library/Zend/Navigation/Container.php +++ b/library/Zend/Navigation/Container.php @@ -1,4 +1,5 @@ {$match[1]}($match[2], $arguments[0], !empty($arguments[1])); } - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( sprintf( 'Bad method call: Unknown method %s::%s', @@ -523,7 +515,6 @@ public function current(): mixed if (isset($this->_pages[$hash])) { return $this->_pages[$hash]; } - require_once 'Zend/Navigation/Exception.php'; throw new Zend_Navigation_Exception( 'Corruption detected in container; ' diff --git a/library/Zend/Navigation/Exception.php b/library/Zend/Navigation/Exception.php index f10d1a211..b51fc663a 100644 --- a/library/Zend/Navigation/Exception.php +++ b/library/Zend/Navigation/Exception.php @@ -1,4 +1,5 @@ _resource = $resource; } else { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $resource must be null, a string, ' . ' or an instance of Zend_Acl_Resource_Interface'); @@ -1031,8 +986,6 @@ public function getVisible($recursive = false) public function setParent(?Zend_Navigation_Container $parent = null) { if ($parent === $this) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'A page cannot have itself as a parent'); } @@ -1082,8 +1035,6 @@ public function getParent() public function set($property, $value) { if (!is_string($property) || empty($property)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $property must be a non-empty string'); } @@ -1114,8 +1065,6 @@ public function set($property, $value) public function get($property) { if (!is_string($property) || empty($property)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $property must be a non-empty string'); } @@ -1195,8 +1144,6 @@ public function __unset($name) { $method = 'set' . self::_normalizePropertyName($name); if (method_exists($this, $method)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception(sprintf( 'Unsetting native property "%s" is not allowed', $name)); diff --git a/library/Zend/Navigation/Page/Mvc.php b/library/Zend/Navigation/Page/Mvc.php index 776a156dd..93a208420 100644 --- a/library/Zend/Navigation/Page/Mvc.php +++ b/library/Zend/Navigation/Page/Mvc.php @@ -1,4 +1,5 @@ getScheme(); if (null !== $scheme) { if (null === self::$_schemeHelper) { - require_once 'Zend/View/Helper/ServerUrl.php'; self::$_schemeHelper = new Zend_View_Helper_ServerUrl(); } @@ -293,8 +282,6 @@ public function getHref() public function setAction($action) { if (null !== $action && !is_string($action)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $action must be a string or null' ); @@ -330,8 +317,6 @@ public function getAction() public function setController($controller) { if (null !== $controller && !is_string($controller)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $controller must be a string or null' ); @@ -367,8 +352,6 @@ public function getController() public function setModule($module) { if (null !== $module && !is_string($module)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $module must be a string or null' ); @@ -541,8 +524,6 @@ public function getParam($name) public function setRoute($route) { if (null !== $route && (!is_string($route) || strlen($route) < 1)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $route must be a non-empty string or null' ); @@ -637,8 +618,6 @@ public function getEncodeUrl() public function setScheme($scheme) { if (null !== $scheme && !is_string($scheme)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $scheme must be a string or null' ); diff --git a/library/Zend/Navigation/Page/Uri.php b/library/Zend/Navigation/Page/Uri.php index 26168e632..aa6504268 100644 --- a/library/Zend/Navigation/Page/Uri.php +++ b/library/Zend/Navigation/Page/Uri.php @@ -1,4 +1,5 @@ _adapter = $adapter->getPaginatorAdapter(); } else { - /** - * @see Zend_Paginator_Exception - */ - require_once 'Zend/Paginator/Exception.php'; - throw new Zend_Paginator_Exception( 'Zend_Paginator only accepts instances of the type ' . 'Zend_Paginator_Adapter_Interface or Zend_Paginator_AdapterAggregate.' @@ -484,20 +434,6 @@ public function __toString() return ''; } - /** - * Enables/Disables the cache for this instance. - * - * @param bool $enable - * - * @return Zend_Paginator - */ - public function setCacheEnabled($enable) - { - $this->_cacheEnabled = (bool) $enable; - - return $this; - } - /** * Returns the number of pages. */ @@ -511,52 +447,13 @@ public function count(): int } /** - * Returns the total number of items available. Uses cache if caching is enabled. + * Returns the total number of items available. * * @return int */ public function getTotalItemCount() { - if (!$this->_cacheEnabled()) { - return count($this->getAdapter()); - } - $cacheId = md5($this->_getCacheInternalId() . '_itemCount'); - $itemCount = self::$_cache->load($cacheId); - - if ($itemCount === false) { - $itemCount = count($this->getAdapter()); - - self::$_cache->save($itemCount, $cacheId, [$this->_getCacheInternalId()]); - } - - return $itemCount; - } - - /** - * Clear the page item cache. - * - * @param int $pageNumber - * - * @return Zend_Paginator - */ - public function clearPageItemCache($pageNumber = null) - { - if (!$this->_cacheEnabled()) { - return $this; - } - - if (null === $pageNumber) { - foreach (self::$_cache->getIdsMatchingTags([$this->_getCacheInternalId()]) as $id) { - if (preg_match('|' . self::CACHE_TAG_PREFIX . "(\d+)_.*|", $id, $page)) { - self::$_cache->remove($this->_getCacheId($page[1])); - } - } - } else { - $cleanId = $this->_getCacheId($pageNumber); - self::$_cache->remove($cleanId); - } - - return $this; + return count($this->getAdapter()); } /** @@ -687,11 +584,6 @@ public function getItem($itemNumber, $pageNumber = null) $itemCount = $this->getItemCount($page); if ($itemCount == 0) { - /** - * @see Zend_Paginator_Exception - */ - require_once 'Zend/Paginator/Exception.php'; - throw new Zend_Paginator_Exception('Page ' . $pageNumber . ' does not exist'); } @@ -702,13 +594,8 @@ public function getItem($itemNumber, $pageNumber = null) $itemNumber = $this->normalizeItemNumber($itemNumber); if ($itemNumber > $itemCount) { - /** - * @see Zend_Paginator_Exception - */ - require_once 'Zend/Paginator/Exception.php'; - throw new Zend_Paginator_Exception('Page ' . $pageNumber . ' does not' - . ' contain item number ' . $itemNumber); + . ' contain item number ' . $itemNumber); } return $page[$itemNumber - 1]; @@ -779,13 +666,6 @@ public function getItemsByPage($pageNumber) { $pageNumber = $this->normalizePageNumber($pageNumber); - if ($this->_cacheEnabled()) { - $data = self::$_cache->load($this->_getCacheId($pageNumber)); - if ($data !== false) { - return $data; - } - } - $offset = ($pageNumber - 1) * $this->getItemCountPerPage(); $items = $this->_adapter->getItems($offset, $this->getItemCountPerPage()); @@ -800,10 +680,6 @@ public function getItemsByPage($pageNumber) $items = new ArrayIterator($items); } - if ($this->_cacheEnabled()) { - self::$_cache->save($items, $this->_getCacheId($pageNumber), [$this->_getCacheInternalId()]); - } - return $items; } @@ -881,25 +757,6 @@ public function getPagesInRange($lowerBound, $upperBound) return $pages; } - /** - * Returns the page item cache. - * - * @return array - */ - public function getPageItemCache() - { - $data = []; - if ($this->_cacheEnabled()) { - foreach (self::$_cache->getIdsMatchingTags([$this->_getCacheInternalId()]) as $id) { - if (preg_match('|' . self::CACHE_TAG_PREFIX . "(\d+)_.*|", $id, $page)) { - $data[$page[1]] = self::$_cache->load($this->_getCacheId($page[1])); - } - } - } - - return $data; - } - /** * Retrieves the view instance. If none registered, attempts to pull f * rom ViewRenderer. @@ -912,8 +769,6 @@ public function getView() /** * @see Zend_Controller_Action_HelperBroker */ - require_once 'Zend/Controller/Action/HelperBroker.php'; - $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); if ($viewRenderer->view === null) { $viewRenderer->initView(); @@ -1007,68 +862,9 @@ public function toJson() { $currentItems = $this->getCurrentItems(); - if ($currentItems instanceof Zend_Db_Table_Rowset_Abstract) { - return Zend_Json::encode($currentItems->toArray()); - } - return Zend_Json::encode($currentItems); } - /** - * Tells if there is an active cache object - * and if the cache has not been desabled. - * - * @return bool - */ - protected function _cacheEnabled() - { - return (self::$_cache !== null) && $this->_cacheEnabled; - } - - /** - * Makes an Id for the cache - * Depends on the adapter object and the page number. - * - * Used to store item in cache from that Paginator instance - * and that current page - * - * @param int $page - * - * @return string - */ - protected function _getCacheId($page = null) - { - if ($page === null) { - $page = $this->getCurrentPageNumber(); - } - - return self::CACHE_TAG_PREFIX . $page . '_' . $this->_getCacheInternalId(); - } - - /** - * Get the internal cache id - * Depends on the adapter and the item count per page. - * - * Used to tag that unique Paginator instance in cache - * - * @return string - */ - protected function _getCacheInternalId() - { - $adapter = $this->getAdapter(); - - if (method_exists($adapter, 'getCacheIdentifier')) { - return md5(serialize([ - $adapter->getCacheIdentifier(), $this->getItemCountPerPage(), - ])); - } - - return md5(serialize([ - $adapter, - $this->getItemCountPerPage(), - ])); - } - /** * Calculates the page count. * @@ -1141,13 +937,8 @@ protected function _loadScrollingStyle($scrollingStyle = null) switch (strtolower(gettype($scrollingStyle))) { case 'object': if (!$scrollingStyle instanceof Zend_Paginator_ScrollingStyle_Interface) { - /** - * @see Zend_View_Exception - */ - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception('Scrolling style must implement ' - . \Zend_Paginator_ScrollingStyle_Interface::class); + . Zend_Paginator_ScrollingStyle_Interface::class); } return $scrollingStyle; @@ -1161,11 +952,6 @@ protected function _loadScrollingStyle($scrollingStyle = null) // Fall through to default case default: - /** - * @see Zend_View_Exception - */ - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception('Scrolling style must be a class ' . 'name or object implementing Zend_Paginator_ScrollingStyle_Interface'); } diff --git a/library/Zend/Paginator/Adapter/Array.php b/library/Zend/Paginator/Adapter/Array.php index 6b1280c0c..384ba1a3a 100644 --- a/library/Zend/Paginator/Adapter/Array.php +++ b/library/Zend/Paginator/Adapter/Array.php @@ -1,4 +1,5 @@ $max) { - require_once 'Zend/ProgressBar/Exception.php'; - - throw new Zend_ProgressBar_Exception('$max must be greater than $min'); - } - - $this->_min = (float) $min; - $this->_max = (float) $max; - $this->_current = (float) $min; - - // See if we have to open a session namespace - if ($persistenceNamespace !== null) { - require_once 'Zend/Session/Namespace.php'; - - $this->_persistenceNamespace = new Zend_Session_Namespace($persistenceNamespace); - } - - // Set adapter - $this->_adapter = $adapter; - - // Track the start time - $this->_startTime = time(); - - // See If a persistenceNamespace exists and handle accordingly - if ($this->_persistenceNamespace !== null) { - if (isset($this->_persistenceNamespace->isSet)) { - $this->_startTime = $this->_persistenceNamespace->startTime; - $this->_current = $this->_persistenceNamespace->current; - $this->_statusText = $this->_persistenceNamespace->statusText; - } else { - $this->_persistenceNamespace->isSet = true; - $this->_persistenceNamespace->startTime = $this->_startTime; - $this->_persistenceNamespace->current = $this->_current; - $this->_persistenceNamespace->statusText = $this->_statusText; - } - } else { - $this->update(); - } - } - - /** - * Get the current adapter. - * - * @return Zend_ProgressBar_Adapter - */ - public function getAdapter() - { - return $this->_adapter; - } - - /** - * Update the progressbar. - * - * @param float $value - * @param string $text - */ - public function update($value = null, $text = null) - { - // Update value if given - if ($value !== null) { - $this->_current = min($this->_max, max($this->_min, $value)); - } - - // Update text if given - if ($text !== null) { - $this->_statusText = $text; - } - - // See if we have to update a namespace - if ($this->_persistenceNamespace !== null) { - $this->_persistenceNamespace->current = $this->_current; - $this->_persistenceNamespace->statusText = $this->_statusText; - } - - // Calculate percent - if ($this->_min === $this->_max) { - $percent = false; - } else { - $percent = (float) ($this->_current - $this->_min) / ($this->_max - $this->_min); - } - - // Calculate ETA - $timeTaken = time() - $this->_startTime; - - if ($percent === .0 || $percent === false) { - $timeRemaining = null; - } else { - $timeRemaining = round(((1 / $percent) * $timeTaken) - $timeTaken); - } - - // Poll the adapter - $this->_adapter->notify($this->_current, $this->_max, $percent, $timeTaken, $timeRemaining, $this->_statusText); - } - - /** - * Update the progressbar to the next value. - * - * @param string $text - * @param mixed $diff - */ - public function next($diff = 1, $text = null) - { - $this->update(max($this->_min, min($this->_max, $this->_current + $diff)), $text); - } - - /** - * Call the adapters finish() behaviour. - */ - public function finish() - { - if ($this->_persistenceNamespace !== null) { - unset($this->_persistenceNamespace->isSet); - } - - $this->_adapter->finish(); - } -} diff --git a/library/Zend/Registry.php b/library/Zend/Registry.php index 5f19d6783..40c3125b8 100644 --- a/library/Zend/Registry.php +++ b/library/Zend/Registry.php @@ -1,4 +1,5 @@ offsetExists($index)) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception("No entry is registered for key '$index'"); } diff --git a/library/Zend/Rest/Client.php b/library/Zend/Rest/Client.php deleted file mode 100644 index 18385400f..000000000 --- a/library/Zend/Rest/Client.php +++ /dev/null @@ -1,292 +0,0 @@ -setUri($uri); - } - } - - /** - * Set the URI to use in the request. - * - * @param string|Zend_Uri_Http $uri URI for the web service - * - * @return Zend_Rest_Client - */ - public function setUri($uri) - { - if ($uri instanceof Zend_Uri_Http) { - $this->_uri = $uri; - } else { - $this->_uri = Zend_Uri::factory($uri); - } - - return $this; - } - - /** - * Retrieve the current request URI object. - * - * @return Zend_Uri_Http - */ - public function getUri() - { - return $this->_uri; - } - - /** - * Call a remote REST web service URI and return the Zend_Http_Response object. - * - * @param string $path The path to append to the URI - */ - private function _prepareRest($path) - { - // Get the URI object and configure it - if (!$this->_uri instanceof Zend_Uri_Http) { - require_once 'Zend/Rest/Client/Exception.php'; - - throw new Zend_Rest_Client_Exception('URI object must be set before performing call'); - } - - $uri = $this->_uri->getUri(); - - if ($path[0] != '/' && $uri[strlen($uri) - 1] != '/') { - $path = '/' . $path; - } - - $this->_uri->setPath($path); - - /* - * Get the HTTP client and configure it for the endpoint URI. Do this each time - * because the Zend_Http_Client instance is shared among all Zend_Service_Abstract subclasses. - */ - if ($this->_noReset) { - // if $_noReset we do not want to reset on this request, - // but we do on any subsequent request - $this->_noReset = false; - } else { - self::getHttpClient()->resetParameters(); - } - - self::getHttpClient()->setUri($this->_uri); - } - - /** - * Tells Zend_Rest_Client not to reset all parameters on it's - * Zend_Http_Client. If you want no reset, this must be called explicitly - * before every request for which you do not want to reset the parameters. - * Parameters will accumulate between requests, but as soon as you do not - * call this function prior to any request, all preset parameters will be reset - * as by default. - * - * @param bool $bool - */ - public function setNoReset($bool = true) - { - $this->_noReset = $bool; - } - - /** - * Performs an HTTP GET request to the $path. - * - * @param string $path - * @param array $query Array of GET parameters - * - * @return Zend_Http_Response - */ - public function restGet($path, ?array $query = null) - { - $this->_prepareRest($path); - $client = self::getHttpClient(); - $client->setParameterGet($query); - - return $client->request('GET'); - } - - /** - * Perform a POST or PUT. - * - * Performs a POST or PUT request. Any data provided is set in the HTTP - * client. String data is pushed in as raw POST data; array or object data - * is pushed in as POST parameters. - * - * @param mixed $method - * @param mixed $data - * - * @return Zend_Http_Response - */ - protected function _performPost($method, $data = null) - { - $client = self::getHttpClient(); - if (is_string($data)) { - $client->setRawData($data); - } elseif (is_array($data) || is_object($data)) { - $client->setParameterPost((array) $data); - } - - return $client->request($method); - } - - /** - * Performs an HTTP POST request to $path. - * - * @param string $path - * @param mixed $data Raw data to send - * - * @return Zend_Http_Response - */ - public function restPost($path, $data = null) - { - $this->_prepareRest($path); - - return $this->_performPost('POST', $data); - } - - /** - * Performs an HTTP PUT request to $path. - * - * @param string $path - * @param mixed $data Raw data to send in request - * - * @return Zend_Http_Response - */ - public function restPut($path, $data = null) - { - $this->_prepareRest($path); - - return $this->_performPost('PUT', $data); - } - - /** - * Performs an HTTP DELETE request to $path. - * - * @param string $path - * @param null|mixed $data - * - * @return Zend_Http_Response - */ - public function restDelete($path, $data = null) - { - $this->_prepareRest($path); - - return $this->_performPost('DELETE', $data); - } - - /** - * Method call overload. - * - * Allows calling REST actions as object methods; however, you must - * follow-up by chaining the request with a request to an HTTP request - * method (post, get, delete, put): - * - * $response = $rest->sayHello('Foo', 'Manchu')->get(); - * - * - * Or use them together, but in sequential calls: - * - * $rest->sayHello('Foo', 'Manchu'); - * $response = $rest->get(); - * - * - * @param string $method Method name - * @param array $args Method args - * - * @return Zend_Rest_Client|Zend_Rest_Client_Result Zend_Rest_Client if using - * a remote method, Zend_Rest_Client_Result if using an HTTP request method - */ - public function __call($method, $args) - { - $methods = ['post', 'get', 'delete', 'put']; - - if (in_array(strtolower($method), $methods)) { - if (!isset($args[0])) { - $args[0] = $this->_uri->getPath(); - } - $this->_data['rest'] = 1; - $data = array_slice($args, 1) + $this->_data; - $response = $this->{'rest' . $method}($args[0], $data); - $this->_data = []; //Initializes for next Rest method. - - return new Zend_Rest_Client_Result($response->getBody()); - } - // More than one arg means it's definitely a Zend_Rest_Server - if (sizeof($args) == 1) { - // Uses first called function name as method name - if (!isset($this->_data['method'])) { - $this->_data['method'] = $method; - $this->_data['arg1'] = $args[0]; - } - $this->_data[$method] = $args[0]; - } else { - $this->_data['method'] = $method; - if (sizeof($args) > 0) { - foreach ($args as $key => $arg) { - $key = 'arg' . $key; - $this->_data[$key] = $arg; - } - } - } - - return $this; - } -} diff --git a/library/Zend/Rest/Client/Exception.php b/library/Zend/Rest/Client/Exception.php deleted file mode 100644 index 15dfb2c05..000000000 --- a/library/Zend/Rest/Client/Exception.php +++ /dev/null @@ -1,33 +0,0 @@ -_sxml = Zend_Xml_Security::scan($data); - restore_error_handler(); - if ($this->_sxml === false) { - if ($this->_errstr === null) { - $message = 'An error occured while parsing the REST response with simplexml.'; - } else { - $message = 'REST Response Error: ' . $this->_errstr; - $this->_errstr = null; - } - require_once 'Zend/Rest/Client/Result/Exception.php'; - - throw new Zend_Rest_Client_Result_Exception($message); - } - } - - /** - * Temporary error handler for parsing REST responses. - * - * @param int $errno - * @param string $errstr - * @param string $errfile - * @param string $errline - * - * @return true - */ - public function handleXmlErrors($errno, $errstr, $errfile = null, $errline = null) - { - $this->_errstr = $errstr; - - return true; - } - - /** - * Casts a SimpleXMLElement to its appropriate PHP value. - * - * @return mixed - */ - public function toValue(SimpleXMLElement $value) - { - $node = dom_import_simplexml($value); - - return $node->nodeValue; - } - - /** - * Get Property Overload. - * - * @param string $name - * - * @return null|array|SimpleXMLElement Null if not found, SimpleXMLElement if only one value found, array of Zend_Rest_Client_Result objects otherwise - */ - public function __get($name) - { - if (isset($this->_sxml->{$name})) { - return $this->_sxml->{$name}; - } - - $result = $this->_sxml->xpath("//$name"); - $count = is_countable($result) ? count($result) : 0; - - if ($count == 0) { - return null; - } - if ($count == 1) { - return $result[0]; - } - - return $result; - } - - /** - * Cast properties to PHP values. - * - * For arrays, loops through each element and casts to a value as well. - * - * @param string $method - * @param array $args - * - * @return mixed - */ - public function __call($method, $args) - { - if (null !== ($value = $this->__get($method))) { - if (!is_array($value)) { - return $this->toValue($value); - } - $return = []; - foreach ($value as $element) { - $return[] = $this->toValue($element); - } - - return $return; - } - - return null; - } - - /** - * Isset Overload. - * - * @param string $name - * - * @return bool - */ - public function __isset($name) - { - if (isset($this->_sxml->{$name})) { - return true; - } - - $result = $this->_sxml->xpath("//$name"); - - if (sizeof($result) > 0) { - return true; - } - - return false; - } - - /** - * Implement IteratorAggregate::getIterator(). - * - * @return SimpleXMLIterator - */ - public function getIterator(): Traversable - { - return $this->_sxml; - } - - /** - * Get Request Status. - * - * @return bool - */ - public function getStatus() - { - $status = $this->_sxml->xpath('//status/text()'); - if (!isset($status[0])) { - return false; - } - - $status = strtolower($status[0]); - - if (ctype_alpha($status) && $status == 'success') { - return true; - } - if (ctype_alpha($status) && $status != 'success') { - return false; - } - - return (bool) $status; - } - - public function isError() - { - $status = $this->getStatus(); - if ($status) { - return false; - } - - return true; - } - - public function isSuccess() - { - $status = $this->getStatus(); - if ($status) { - return true; - } - - return false; - } - - /** - * toString overload. - * - * Be sure to only call this when the result is a single value! - * - * @return string - */ - public function __toString() - { - if (!$this->getStatus()) { - $message = $this->_sxml->xpath('//message'); - - return (string) $message[0]; - } - $result = $this->_sxml->xpath('//response'); - if (sizeof($result) > 1) { - return (string) 'An error occured.'; - } - - return (string) $result[0]; - } -} diff --git a/library/Zend/Rest/Client/Result/Exception.php b/library/Zend/Rest/Client/Result/Exception.php deleted file mode 100644 index 30b18d665..000000000 --- a/library/Zend/Rest/Client/Result/Exception.php +++ /dev/null @@ -1,33 +0,0 @@ -Controllers to receive RESTful routes. - * - * @var array - */ - protected $_restfulControllers; - - /** - * @var Zend_Controller_Front - */ - protected $_front; - - /** - * Constructor. - * - * @param Zend_Controller_Front $front Front Controller object - * @param array $defaults Defaults for map variables with keys as variable names - * @param array $responders Modules or controllers to receive RESTful routes - */ - public function __construct(Zend_Controller_Front $front, - array $defaults = [], - array $responders = [] - ) { - $this->_defaults = $defaults; - - if ($responders) { - $this->_parseResponders($responders); - } - - $this->_front = $front; - $this->_dispatcher = $front->getDispatcher(); - } - - /** - * Instantiates route based on passed Zend_Config structure. - */ - public static function getInstance(Zend_Config $config) - { - $frontController = Zend_Controller_Front::getInstance(); - $defaultsArray = []; - $restfulConfigArray = []; - foreach ($config as $key => $values) { - if ($key == 'type') { - // do nothing - } elseif ($key == 'defaults') { - $defaultsArray = $values->toArray(); - } else { - $restfulConfigArray[$key] = explode(',', $values); - } - } - $instance = new self($frontController, $defaultsArray, $restfulConfigArray); - - return $instance; - } - - /** - * Matches a user submitted request. Assigns and returns an array of variables - * on a successful match. - * - * If a request object is registered, it uses its setModuleName(), - * setControllerName(), and setActionName() accessors to set those values. - * Always returns the values as an array. - * - * @param Zend_Controller_Request_Http $request Request used to match against this routing ruleset - * @param mixed $partial - * - * @return array An array of assigned values or a false on a mismatch - */ - public function match($request, $partial = false) - { - if (!$request instanceof Zend_Controller_Request_Http) { - $request = $this->_front->getRequest(); - } - $this->_request = $request; - $this->_setRequestKeys(); - - $path = $request->getPathInfo(); - $params = $request->getParams(); - $values = []; - $path = trim($path, self::URI_DELIMITER); - - if ($path != '') { - $path = explode(self::URI_DELIMITER, $path); - // Determine Module - $moduleName = $this->_defaults[$this->_moduleKey]; - $dispatcher = $this->_front->getDispatcher(); - if ($dispatcher && $dispatcher->isValidModule($path[0])) { - $moduleName = $path[0]; - if ($this->_checkRestfulModule($moduleName)) { - $values[$this->_moduleKey] = array_shift($path); - $this->_moduleValid = true; - } - } - - // Determine Controller - $controllerName = $this->_defaults[$this->_controllerKey]; - if (count($path) && !empty($path[0])) { - if ($this->_checkRestfulController($moduleName, $path[0])) { - $controllerName = $path[0]; - $values[$this->_controllerKey] = array_shift($path); - $values[$this->_actionKey] = 'get'; - } else { - // If Controller in URI is not found to be a RESTful - // Controller, return false to fall back to other routes - return false; - } - } elseif ($this->_checkRestfulController($moduleName, $controllerName)) { - $values[$this->_controllerKey] = $controllerName; - $values[$this->_actionKey] = 'get'; - } else { - return false; - } - - //Store path count for method mapping - $pathElementCount = count($path); - - // Check for "special get" URI's - $specialGetTarget = false; - if ($pathElementCount && array_search($path[0], ['index', 'new']) > -1) { - $specialGetTarget = array_shift($path); - } elseif ($pathElementCount && $path[$pathElementCount - 1] == 'edit') { - $specialGetTarget = 'edit'; - $params['id'] = urldecode($path[$pathElementCount - 2]); - } elseif ($pathElementCount == 1) { - $params['id'] = urldecode(array_shift($path)); - } elseif ($pathElementCount == 0 && !isset($params['id'])) { - $specialGetTarget = 'index'; - } - - // Digest URI params - if ($numSegs = count($path)) { - for ($i = 0; $i < $numSegs; $i = $i + 2) { - $key = urldecode($path[$i]); - $val = $path[$i + 1] ?? null; - $params[$key] = urldecode($val); - } - } - - // Determine Action - $requestMethod = strtolower($request->getMethod()); - if ($requestMethod != 'get') { - if ($request->getParam('_method')) { - $values[$this->_actionKey] = strtolower($request->getParam('_method')); - } elseif ($request->getHeader('X-HTTP-Method-Override')) { - $values[$this->_actionKey] = strtolower($request->getHeader('X-HTTP-Method-Override')); - } else { - $values[$this->_actionKey] = $requestMethod; - } - - // Map PUT and POST to actual create/update actions - // based on parameter count (posting to resource or collection) - switch ($values[$this->_actionKey]) { - case 'post': - if ($pathElementCount > 0) { - $values[$this->_actionKey] = 'put'; - } else { - $values[$this->_actionKey] = 'post'; - } - - break; - case 'put': - $values[$this->_actionKey] = 'put'; - - break; - } - } elseif ($specialGetTarget) { - $values[$this->_actionKey] = $specialGetTarget; - } - } - $this->_values = $values + $params; - - $result = $this->_values + $this->_defaults; - - if ($partial && $result) { - $this->setMatchedPath($request->getPathInfo()); - } - - return $result; - } - - /** - * Assembles user submitted parameters forming a URL path defined by this route. - * - * @param array $data An array of variable and value pairs used as parameters - * @param bool $reset Weither to reset the current params - * @param bool $encode Weither to return urlencoded string - * @param mixed $partial - * - * @return string Route path with user submitted parameters - */ - public function assemble($data = [], $reset = false, $encode = true, $partial = false) - { - if (!$this->_keysSet) { - if (null === $this->_request) { - $this->_request = $this->_front->getRequest(); - } - $this->_setRequestKeys(); - } - - $params = (!$reset) ? $this->_values : []; - - foreach ($data as $key => $value) { - if ($value !== null) { - $params[$key] = $value; - } elseif (isset($params[$key])) { - unset($params[$key]); - } - } - - $params += $this->_defaults; - - $url = ''; - - if ($this->_moduleValid || array_key_exists($this->_moduleKey, $data)) { - if ($params[$this->_moduleKey] != $this->_defaults[$this->_moduleKey]) { - $module = $params[$this->_moduleKey]; - } - } - unset($params[$this->_moduleKey]); - - $controller = $params[$this->_controllerKey]; - unset($params[$this->_controllerKey]); - - // set $action if value given is 'new' or 'edit' - if (in_array($params[$this->_actionKey], ['new', 'edit'])) { - $action = $params[$this->_actionKey]; - } - unset($params[$this->_actionKey]); - - if (isset($params['index']) && $params['index']) { - unset($params['index']); - $url .= '/index'; - if (isset($params['id'])) { - $url .= '/' . $params['id']; - unset($params['id']); - } - foreach ($params as $key => $value) { - if ($encode) { - $value = urlencode($value); - } - $url .= '/' . $key . '/' . $value; - } - } elseif (!empty($action) && isset($params['id'])) { - $url .= sprintf('/%s/%s', $params['id'], $action); - } elseif (!empty($action)) { - $url .= sprintf('/%s', $action); - } elseif (isset($params['id'])) { - $url .= '/' . $params['id']; - } - - if (!empty($url) || $controller !== $this->_defaults[$this->_controllerKey]) { - $url = '/' . $controller . $url; - } - - if (isset($module)) { - $url = '/' . $module . $url; - } - - return ltrim($url, self::URI_DELIMITER); - } - - /** - * Tells Rewrite Router which version this Route is. - * - * @return int Route "version" - */ - public function getVersion() - { - return 2; - } - - /** - * Parses the responders array sent to constructor to know - * which modules and/or controllers are RESTful. - * - * @param array $responders - */ - protected function _parseResponders($responders) - { - $modulesOnly = true; - foreach ($responders as $responder) { - if (is_array($responder)) { - $modulesOnly = false; - - break; - } - } - if ($modulesOnly) { - $this->_restfulModules = $responders; - } else { - $this->_restfulControllers = $responders; - } - } - - /** - * Determine if a specified module supports RESTful routing. - * - * @param string $moduleName - * - * @return bool - */ - protected function _checkRestfulModule($moduleName) - { - if ($this->_allRestful()) { - return true; - } - if ($this->_fullRestfulModule($moduleName)) { - return true; - } - if ($this->_restfulControllers && array_key_exists($moduleName, $this->_restfulControllers)) { - return true; - } - - return false; - } - - /** - * Determine if a specified module + controller combination supports - * RESTful routing. - * - * @param string $moduleName - * @param string $controllerName - * - * @return bool - */ - protected function _checkRestfulController($moduleName, $controllerName) - { - if ($this->_allRestful()) { - return true; - } - if ($this->_fullRestfulModule($moduleName)) { - return true; - } - if ($this->_checkRestfulModule($moduleName) - && $this->_restfulControllers - && (false !== array_search($controllerName, $this->_restfulControllers[$moduleName])) - ) { - return true; - } - - return false; - } - - /** - * Determines if RESTful routing applies to the entire app. - * - * @return bool - */ - protected function _allRestful() - { - return !$this->_restfulModules && !$this->_restfulControllers; - } - - /** - * Determines if RESTful routing applies to an entire module. - * - * @param string $moduleName - * - * @return bool - */ - protected function _fullRestfulModule($moduleName) - { - return - $this->_restfulModules - && (false !== array_search($moduleName, $this->_restfulModules)); - } -} diff --git a/library/Zend/Service/Abstract.php b/library/Zend/Service/Abstract.php deleted file mode 100644 index ad62c8dff..000000000 --- a/library/Zend/Service/Abstract.php +++ /dev/null @@ -1,60 +0,0 @@ - $valid_data) { if (!class_exists($validator_name)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($validator_name); } $validator = new $validator_name(); if ($validator->validate() === false) { - /** @see Zend_Session_Validator_Exception */ - require_once 'Zend/Session/Validator/Exception.php'; - throw new Zend_Session_Validator_Exception("This session is not valid according to {$validator_name}."); } } @@ -798,9 +751,6 @@ public static function namespaceGet($namespace) public static function getIterator() { if (parent::$_readable === false) { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(parent::_THROW_NOT_READABLE_MSG); } diff --git a/library/Zend/Session/Abstract.php b/library/Zend/Session/Abstract.php index a396b8268..8a0fc5ed9 100644 --- a/library/Zend/Session/Abstract.php +++ b/library/Zend/Session/Abstract.php @@ -73,11 +73,6 @@ abstract class Zend_Session_Abstract protected static function _namespaceIsset($namespace, $name = null) { if (self::$_readable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG); } @@ -97,11 +92,6 @@ protected static function _namespaceIsset($namespace, $name = null) protected static function _namespaceUnset($namespace, $name = null) { if (self::$_writable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(self::_THROW_NOT_WRITABLE_MSG); } @@ -131,11 +121,6 @@ protected static function _namespaceUnset($namespace, $name = null) protected static function &_namespaceGet($namespace, $name = null) { if (self::$_readable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG); } diff --git a/library/Zend/Session/Exception.php b/library/Zend/Session/Exception.php index d276049ff..429c03c7c 100644 --- a/library/Zend/Session/Exception.php +++ b/library/Zend/Session/Exception.php @@ -1,4 +1,5 @@ _namespace])) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('This session/namespace has been marked as read-only.'); } if ($name === '') { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception("The '$name' key must be a non-empty string"); } if (parent::$_writable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(parent::_THROW_NOT_WRITABLE_MSG); } @@ -349,11 +295,6 @@ public function applySet($callback) $arg_list[0] = $_SESSION[$this->_namespace]; $result = call_user_func_array($callback, $arg_list); if (!is_array($result)) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Result must be an array. Got: ' . gettype($result)); } $_SESSION[$this->_namespace] = $result; @@ -371,11 +312,6 @@ public function applySet($callback) public function __isset($name) { if ($name === '') { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception("The '$name' key must be a non-empty string"); } @@ -392,11 +328,6 @@ public function __isset($name) public function __unset($name) { if ($name === '') { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception("The '$name' key must be a non-empty string"); } @@ -413,20 +344,10 @@ public function __unset($name) public function setExpirationSeconds($seconds, $variables = null) { if (parent::$_writable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(parent::_THROW_NOT_WRITABLE_MSG); } if ($seconds <= 0) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Seconds must be positive.'); } @@ -457,20 +378,10 @@ public function setExpirationSeconds($seconds, $variables = null) public function setExpirationHops($hops, $variables = null, $hopCountOnUsageOnly = false) { if (parent::$_writable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(parent::_THROW_NOT_WRITABLE_MSG); } if ($hops <= 0) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Hops must be positive number.'); } diff --git a/library/Zend/Session/SaveHandler/Interface.php b/library/Zend/Session/SaveHandler/Interface.php index 968692fee..7a00b7229 100644 --- a/library/Zend/Session/SaveHandler/Interface.php +++ b/library/Zend/Session/SaveHandler/Interface.php @@ -1,4 +1,5 @@ $name = $value; @@ -137,7 +124,6 @@ final public function bootstrap() } elseif (is_callable($this->bootstrap)) { call_user_func($this->bootstrap); } elseif (is_string($this->bootstrap)) { - require_once 'Zend/Loader.php'; if (Zend_Loader::isReadable($this->bootstrap)) { include $this->bootstrap; } @@ -451,7 +437,6 @@ public function getFrontController() public function getRequest() { if (null === $this->_request) { - require_once 'Zend/Controller/Request/HttpTestCase.php'; $this->_request = new Zend_Controller_Request_HttpTestCase(); } @@ -466,7 +451,6 @@ public function getRequest() public function getResponse() { if (null === $this->_response) { - require_once 'Zend/Controller/Response/HttpTestCase.php'; $this->_response = new Zend_Controller_Response_HttpTestCase(); } @@ -525,7 +509,7 @@ protected function _incrementAssertionCount() $stack = debug_backtrace(); foreach ($stack as $step) { if (isset($step['object']) - && $step['object'] instanceof \PHPUnit\Framework\TestCase + && $step['object'] instanceof PHPUnit\Framework\TestCase ) { $step['object']->addToAssertionCount(1); diff --git a/library/Zend/Text/Exception.php b/library/Zend/Text/Exception.php deleted file mode 100644 index 6e1cd4b2a..000000000 --- a/library/Zend/Text/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ -setOptions($options); - } elseif ($options instanceof Zend_Config) { - $this->setConfig($options); - } - - // If no font was defined, load default font - if (!$this->_fontLoaded) { - $this->_loadFont(dirname(__FILE__) . '/Figlet/zend-framework.flf'); - } - } - - /** - * Set options from array. - * - * @param array $options Configuration for Zend_Text_Figlet - * - * @return Zend_Text_Figlet - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - if (in_array(strtolower($key), $this->_skipOptions)) { - continue; - } - - $method = 'set' . ucfirst($key); - if (method_exists($this, $method)) { - $this->$method($value); - } - } - - return $this; - } - - /** - * Set options from config object. - * - * @param Zend_Config $config Configuration for Zend_Text_Figlet - * - * @return Zend_Text_Figlet - */ - public function setConfig(Zend_Config $config) - { - return $this->setOptions($config->toArray()); - } - - /** - * Set a font to use. - * - * @param string $font Path to the font - * - * @return Zend_Text_Figlet - */ - public function setFont($font) - { - $this->_loadFont($font); - - return $this; - } - - /** - * Set handling of paragraphs. - * - * @param bool $handleParagraphs Wether to handle paragraphs or not - * - * @return Zend_Text_Figlet - */ - public function setHandleParagraphs($handleParagraphs) - { - $this->_handleParagraphs = (bool) $handleParagraphs; - - return $this; - } - - /** - * Set the justification. 0 stands for left aligned, 1 for centered and 2 - * for right aligned. - * - * @param int $justification Justification of the output text - * - * @return Zend_Text_Figlet - */ - public function setJustification($justification) - { - $this->_justification = min(3, max(0, (int) $justification)); - - return $this; - } - - /** - * Set the output width. - * - * @param int $outputWidth Output with which should be used for word - * wrapping and justification - * - * @return Zend_Text_Figlet - */ - public function setOutputWidth($outputWidth) - { - $this->_outputWidth = max(1, (int) $outputWidth); - - return $this; - } - - /** - * Set right to left mode. For writing from left to right, use - * Zend_Text_Figlet::DIRECTION_LEFT_TO_RIGHT. For writing from right to left, - * use Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT. - * - * @param int $rightToLeft Right-to-left mode - * - * @return Zend_Text_Figlet - */ - public function setRightToLeft($rightToLeft) - { - $this->_rightToLeft = min(1, max(0, (int) $rightToLeft)); - - return $this; - } - - /** - * Set the smush mode. - * - * Use one of the constants of Zend_Text_Figlet::SM_*, you may combine them. - * - * @param int $smushMode Smush mode to use for generating text - * - * @return Zend_Text_Figlet - */ - public function setSmushMode($smushMode) - { - $smushMode = (int) $smushMode; - - if ($smushMode < -1) { - $this->_smushOverride = self::SMO_NO; - } else { - if ($smushMode === 0) { - $this->_userSmush = self::SM_KERN; - } elseif ($smushMode === -1) { - $this->_userSmush = 0; - } else { - $this->_userSmush = (($smushMode & 63) | self::SM_SMUSH); - } - - $this->_smushOverride = self::SMO_YES; - } - - $this->_setUsedSmush(); - - return $this; - } - - /** - * Render a FIGlet text. - * - * @param string $text Text to convert to a figlet text - * @param string $encoding Encoding of the input string - * - * @return string - */ - public function render($text, $encoding = 'UTF-8') - { - if (!is_string($text)) { - throw new InvalidArgumentException('$text must be a string'); - } - - if ($encoding !== 'UTF-8') { - $text = iconv($encoding, 'UTF-8', $text); - } - - $this->_output = ''; - $this->_outputLine = []; - - $this->_clearLine(); - - $this->_outlineLengthLimit = ($this->_outputWidth - 1); - $this->_inCharLineLengthLimit = ($this->_outputWidth * 4 + 100); - - $wordBreakMode = 0; - $lastCharWasEol = false; - $textLength = @iconv_strlen($text, 'UTF-8'); - - if ($textLength === false) { - require_once 'Zend/Text/Figlet/Exception.php'; - - throw new Zend_Text_Figlet_Exception('$text is not encoded with ' . $encoding); - } - - for ($charNum = 0; $charNum < $textLength; ++$charNum) { - // Handle paragraphs - $char = iconv_substr($text, $charNum, 1, 'UTF-8'); - - if ($char === "\n" && $this->_handleParagraphs && !$lastCharWasEol) { - $nextChar = iconv_substr($text, ($charNum + 1), 1, 'UTF-8'); - if (!$nextChar) { - $nextChar = null; - } - - $char = (ctype_space($nextChar)) ? "\n" : ' '; - } - - $lastCharWasEol = (ctype_space($char) && $char !== "\t" && $char !== ' '); - - if (ctype_space($char)) { - $char = ($char === "\t" || $char === ' ') ? ' ' : "\n"; - } - - // Skip unprintable characters - $ordChar = $this->_uniOrd($char); - if (($ordChar > 0 && $ordChar < 32 && $char !== "\n") || $ordChar === 127) { - continue; - } - - // Build the character - // Note: The following code is complex and thoroughly tested. - // Be careful when modifying! - do { - $charNotAdded = false; - - if ($wordBreakMode === -1) { - if ($char === ' ') { - break; - } - if ($char === "\n") { - $wordBreakMode = 0; - - break; - } - - $wordBreakMode = 0; - } - - if ($char === "\n") { - $this->_appendLine(); - $wordBreakMode = false; - } elseif ($this->_addChar($char)) { - if ($char !== ' ') { - $wordBreakMode = ($wordBreakMode >= 2) ? 3 : 1; - } else { - $wordBreakMode = ($wordBreakMode > 0) ? 2 : 0; - } - } elseif ($this->_outlineLength === 0) { - for ($i = 0; $i < $this->_charHeight; ++$i) { - if ($this->_rightToLeft === 1 && $this->_outputWidth > 1) { - $offset = (strlen($this->_currentChar[$i]) - $this->_outlineLengthLimit); - $this->_putString(substr($this->_currentChar[$i], $offset)); - } else { - $this->_putString($this->_currentChar[$i]); - } - } - - $wordBreakMode = -1; - } elseif ($char === ' ') { - if ($wordBreakMode === 2) { - $this->_splitLine(); - } else { - $this->_appendLine(); - } - - $wordBreakMode = -1; - } else { - if ($wordBreakMode >= 2) { - $this->_splitLine(); - } else { - $this->_appendLine(); - } - - $wordBreakMode = ($wordBreakMode === 3) ? 1 : 0; - $charNotAdded = true; - } - } while ($charNotAdded); - } - - if ($this->_outlineLength !== 0) { - $this->_appendLine(); - } - - return $this->_output; - } - - /** - * Puts the given string, substituting blanks for hardblanks. If outputWidth - * is 1, puts the entire string; otherwise puts at most outputWidth - 1 - * characters. Puts a newline at the end of the string. The string is left- - * justified, centered or right-justified (taking outputWidth as the screen - * width) if justification is 0, 1 or 2 respectively. - * - * @param string $string The string to add to the output - */ - protected function _putString($string) - { - $length = strlen($string); - - if ($this->_outputWidth > 1) { - if ($length > ($this->_outputWidth - 1)) { - $length = ($this->_outputWidth - 1); - } - - if ($this->_justification > 0) { - for ($i = 1; - ((3 - $this->_justification) * $i + $length + $this->_justification - 2) < $this->_outputWidth; - ++$i) { - $this->_output .= ' '; - } - } - } - - $this->_output .= str_replace($this->_hardBlank, ' ', $string) . "\n"; - } - - /** - * Appends the current line to the output. - */ - protected function _appendLine() - { - for ($i = 0; $i < $this->_charHeight; ++$i) { - $this->_putString($this->_outputLine[$i]); - } - - $this->_clearLine(); - } - - /** - * Splits inCharLine at the last word break (bunch of consecutive blanks). - * Makes a new line out of the first part and appends it using appendLine(). - * Makes a new line out of the second part and returns. - */ - protected function _splitLine() - { - $gotSpace = false; - for ($i = ($this->_inCharLineLength - 1); $i >= 0; --$i) { - if (!$gotSpace && $this->_inCharLine[$i] === ' ') { - $gotSpace = true; - $lastSpace = $i; - } - - if ($gotSpace && $this->_inCharLine[$i] !== ' ') { - break; - } - } - - $firstLength = ($i + 1); - $lastLength = ($this->_inCharLineLength - $lastSpace - 1); - - $firstPart = ''; - for ($i = 0; $i < $firstLength; ++$i) { - $firstPart[$i] = $this->_inCharLine[$i]; - } - - $lastPart = ''; - for ($i = 0; $i < $lastLength; ++$i) { - $lastPart[$i] = $this->_inCharLine[($lastSpace + 1 + $i)]; - } - - $this->_clearLine(); - - for ($i = 0; $i < $firstLength; ++$i) { - $this->_addChar($firstPart[$i]); - } - - $this->_appendLine(); - - for ($i = 0; $i < $lastLength; ++$i) { - $this->_addChar($lastPart[$i]); - } - } - - /** - * Clears the current line. - */ - protected function _clearLine() - { - for ($i = 0; $i < $this->_charHeight; ++$i) { - $this->_outputLine[$i] = ''; - } - - $this->_outlineLength = 0; - $this->_inCharLineLength = 0; - } - - /** - * Attempts to add the given character onto the end of the current line. - * Returns true if this can be done, false otherwise. - * - * @param string $char Character which to add to the output - * - * @return bool - */ - protected function _addChar($char) - { - $this->_getLetter($char); - - if ($this->_currentChar === null) { - return true; - } - - $smushAmount = $this->_smushAmount(); - - if (($this->_outlineLength + $this->_currentCharWidth - $smushAmount) > $this->_outlineLengthLimit - || ($this->_inCharLineLength + 1) > $this->_inCharLineLengthLimit) { - return false; - } - - $tempLine = ''; - for ($row = 0; $row < $this->_charHeight; ++$row) { - if ($this->_rightToLeft === 1) { - $tempLine = $this->_currentChar[$row]; - - for ($k = 0; $k < $smushAmount; ++$k) { - $position = ($this->_currentCharWidth - $smushAmount + $k); - $tempLine[$position] = $this->_smushem($tempLine[$position], $this->_outputLine[$row][$k]); - } - - $this->_outputLine[$row] = $tempLine . substr($this->_outputLine[$row], $smushAmount); - } else { - for ($k = 0; $k < $smushAmount; ++$k) { - if (($this->_outlineLength - $smushAmount + $k) < 0) { - continue; - } - - $position = ($this->_outlineLength - $smushAmount + $k); - if (isset($this->_outputLine[$row][$position])) { - $leftChar = $this->_outputLine[$row][$position]; - } else { - $leftChar = null; - } - - $this->_outputLine[$row][$position] = $this->_smushem($leftChar, $this->_currentChar[$row][$k]); - } - - $this->_outputLine[$row] .= substr($this->_currentChar[$row], $smushAmount); - } - } - - $this->_outlineLength = strlen($this->_outputLine[0]); - $this->_inCharLine[$this->_inCharLineLength++] = $char; - - return true; - } - - /** - * Gets the requested character and sets current and previous char width. - * - * @param string $char The character from which to get the letter of - */ - protected function _getLetter($char) - { - if (array_key_exists($this->_uniOrd($char), $this->_charList)) { - $this->_currentChar = $this->_charList[$this->_uniOrd($char)]; - $this->_previousCharWidth = $this->_currentCharWidth; - $this->_currentCharWidth = strlen($this->_currentChar[0]); - } else { - $this->_currentChar = null; - } - } - - /** - * Returns the maximum amount that the current character can be smushed into - * the current line. - * - * @return int - */ - protected function _smushAmount() - { - if (($this->_smushMode & (self::SM_SMUSH | self::SM_KERN)) === 0) { - return 0; - } - - $maxSmush = $this->_currentCharWidth; - $amount = $maxSmush; - - for ($row = 0; $row < $this->_charHeight; ++$row) { - if ($this->_rightToLeft === 1) { - $charbd = strlen($this->_currentChar[$row]); - while (true) { - if (!isset($this->_currentChar[$row][$charbd])) { - $leftChar = null; - } else { - $leftChar = $this->_currentChar[$row][$charbd]; - } - - if ($charbd > 0 && ($leftChar === null || $leftChar == ' ')) { - --$charbd; - } else { - break; - } - } - - $linebd = 0; - while (true) { - if (!isset($this->_outputLine[$row][$linebd])) { - $rightChar = null; - } else { - $rightChar = $this->_outputLine[$row][$linebd]; - } - - if ($rightChar === ' ') { - ++$linebd; - } else { - break; - } - } - - $amount = ($linebd + $this->_currentCharWidth - 1 - $charbd); - } else { - $linebd = strlen($this->_outputLine[$row]); - while (true) { - if (!isset($this->_outputLine[$row][$linebd])) { - $leftChar = null; - } else { - $leftChar = $this->_outputLine[$row][$linebd]; - } - - if ($linebd > 0 && ($leftChar === null || $leftChar == ' ')) { - --$linebd; - } else { - break; - } - } - - $charbd = 0; - while (true) { - if (!isset($this->_currentChar[$row][$charbd])) { - $rightChar = null; - } else { - $rightChar = $this->_currentChar[$row][$charbd]; - } - - if ($rightChar === ' ') { - ++$charbd; - } else { - break; - } - } - - $amount = ($charbd + $this->_outlineLength - 1 - $linebd); - } - - if (empty($leftChar) || $leftChar === ' ') { - ++$amount; - } elseif (!empty($rightChar)) { - if ($this->_smushem($leftChar, $rightChar) !== null) { - ++$amount; - } - } - - $maxSmush = min($amount, $maxSmush); - } - - return $maxSmush; - } - - /** - * Given two characters, attempts to smush them into one, according to the - * current smushmode. Returns smushed character or false if no smushing can - * be done. - * - * Smushmode values are sum of following (all values smush blanks): - * - * 1: Smush equal chars (not hardblanks) - * 2: Smush '_' with any char in hierarchy below - * 4: hierarchy: "|", "/\", "[]", "{}", "()", "<>" - * Each class in hier. can be replaced by later class. - * 8: [ + ] -> |, { + } -> |, ( + ) -> | - * 16: / + \ -> X, > + < -> X (only in that order) - * 32: hardblank + hardblank -> hardblank - * - * @param string $leftChar Left character to smush - * @param string $rightChar Right character to smush - * - * @return string - */ - protected function _smushem($leftChar, $rightChar) - { - if ($leftChar === ' ') { - return $rightChar; - } - - if ($rightChar === ' ') { - return $leftChar; - } - - if ($this->_previousCharWidth < 2 || $this->_currentCharWidth < 2) { - // Disallows overlapping if the previous character or the current - // character has a width of one or zero. - return null; - } - - if (($this->_smushMode & self::SM_SMUSH) === 0) { - // Kerning - return null; - } - - if (($this->_smushMode & 63) === 0) { - // This is smushing by universal overlapping - if ($leftChar === ' ') { - return $rightChar; - } - if ($rightChar === ' ') { - return $leftChar; - } - if ($leftChar === $this->_hardBlank) { - return $rightChar; - } - if ($rightChar === $this->_hardBlank) { - return $rightChar; - } - if ($this->_rightToLeft === 1) { - return $leftChar; - } - - // Occurs in the absence of above exceptions - return $rightChar; - } - - if (($this->_smushMode & self::SM_HARDBLANK) > 0) { - if ($leftChar === $this->_hardBlank && $rightChar === $this->_hardBlank) { - return $leftChar; - } - } - - if ($leftChar === $this->_hardBlank && $rightChar === $this->_hardBlank) { - return null; - } - - if (($this->_smushMode & self::SM_EQUAL) > 0) { - if ($leftChar === $rightChar) { - return $leftChar; - } - } - - if (($this->_smushMode & self::SM_LOWLINE) > 0) { - if ($leftChar === '_' && strchr('|/\\[]{}()<>', $rightChar) !== false) { - return $rightChar; - } - if ($rightChar === '_' && strchr('|/\\[]{}()<>', $leftChar) !== false) { - return $leftChar; - } - } - - if (($this->_smushMode & self::SM_HIERARCHY) > 0) { - if ($leftChar === '|' && strchr('/\\[]{}()<>', $rightChar) !== false) { - return $rightChar; - } - if ($rightChar === '|' && strchr('/\\[]{}()<>', $leftChar) !== false) { - return $leftChar; - } - if (strchr('/\\', $leftChar) && strchr('[]{}()<>', $rightChar) !== false) { - return $rightChar; - } - if (strchr('/\\', $rightChar) && strchr('[]{}()<>', $leftChar) !== false) { - return $leftChar; - } - if (strchr('[]', $leftChar) && strchr('{}()<>', $rightChar) !== false) { - return $rightChar; - } - if (strchr('[]', $rightChar) && strchr('{}()<>', $leftChar) !== false) { - return $leftChar; - } - if (strchr('{}', $leftChar) && strchr('()<>', $rightChar) !== false) { - return $rightChar; - } - if (strchr('{}', $rightChar) && strchr('()<>', $leftChar) !== false) { - return $leftChar; - } - if (strchr('()', $leftChar) && strchr('<>', $rightChar) !== false) { - return $rightChar; - } - if (strchr('()', $rightChar) && strchr('<>', $leftChar) !== false) { - return $leftChar; - } - } - - if (($this->_smushMode & self::SM_PAIR) > 0) { - if ($leftChar === '[' && $rightChar === ']') { - return '|'; - } - if ($rightChar === '[' && $leftChar === ']') { - return '|'; - } - if ($leftChar === '{' && $rightChar === '}') { - return '|'; - } - if ($rightChar === '{' && $leftChar === '}') { - return '|'; - } - if ($leftChar === '(' && $rightChar === ')') { - return '|'; - } - if ($rightChar === '(' && $leftChar === ')') { - return '|'; - } - } - - if (($this->_smushMode & self::SM_BIGX) > 0) { - if ($leftChar === '/' && $rightChar === '\\') { - return '|'; - } - if ($rightChar === '/' && $leftChar === '\\') { - return 'Y'; - } - if ($leftChar === '>' && $rightChar === '<') { - return 'X'; - } - } - - return null; - } - - /** - * Load the specified font. - * - * @param string $fontFile Font file to load - */ - protected function _loadFont($fontFile) - { - // Check if the font file exists - if (!file_exists($fontFile)) { - require_once 'Zend/Text/Figlet/Exception.php'; - - throw new Zend_Text_Figlet_Exception($fontFile . ': Font file not found'); - } - - // Check if gzip support is required - if (substr($fontFile, -3) === '.gz') { - if (!function_exists('gzcompress')) { - require_once 'Zend/Text/Figlet/Exception.php'; - - throw new Zend_Text_Figlet_Exception('GZIP library is required for ' - . 'gzip compressed font files'); - } - - $fontFile = 'compress.zlib://' . $fontFile; - $compressed = true; - } else { - $compressed = false; - } - - // Try to open the file - $fp = fopen($fontFile, 'rb'); - if ($fp === false) { - require_once 'Zend/Text/Figlet/Exception.php'; - - throw new Zend_Text_Figlet_Exception($fontFile . ': Could not open file'); - } - - // If the file is not compressed, lock the stream - if (!$compressed) { - flock($fp, LOCK_SH); - } - - // Get magic - $magic = $this->_readMagic($fp); - - // Get the header - $numsRead = sscanf(fgets($fp, 1000), - '%*c%c %d %*d %d %d %d %d %d', - $this->_hardBlank, - $this->_charHeight, - $this->_maxLength, - $smush, - $cmtLines, - $rightToLeft, - $this->_fontSmush); - - if ($magic !== self::FONTFILE_MAGIC_NUMBER || $numsRead < 5) { - require_once 'Zend/Text/Figlet/Exception.php'; - - throw new Zend_Text_Figlet_Exception($fontFile . ': Not a FIGlet 2 font file'); - } - - // Set default right to left - if ($numsRead < 6) { - $rightToLeft = 0; - } - - // If no smush2, decode smush into smush2 - if ($numsRead < 7) { - if ($smush === 2) { - $this->_fontSmush = self::SM_KERN; - } elseif ($smush < 0) { - $this->_fontSmush = 0; - } else { - $this->_fontSmush = (($smush & 31) | self::SM_SMUSH); - } - } - - // Correct char height && maxlength - $this->_charHeight = max(1, $this->_charHeight); - $this->_maxLength = max(1, $this->_maxLength); - - // Give ourselves some extra room - $this->_maxLength += 100; - - // See if we have to override smush settings - $this->_setUsedSmush(); - - // Get left to right value - if ($this->_rightToLeft === null) { - $this->_rightToLeft = $rightToLeft; - } - - // Get justification value - if ($this->_justification === null) { - $this->_justification = (2 * $this->_rightToLeft); - } - - // Skip all comment lines - for ($line = 1; $line <= $cmtLines; ++$line) { - $this->_skipToEol($fp); - } - - // Fetch all ASCII characters - for ($asciiCode = 32; $asciiCode < 127; ++$asciiCode) { - $this->_charList[$asciiCode] = $this->_loadChar($fp); - } - - // Fetch all german characters - foreach ($this->_germanChars as $uniCode) { - $char = $this->_loadChar($fp); - - if ($char === false) { - fclose($fp); - - return; - } - - if (trim(implode('', $char)) !== '') { - $this->_charList[$uniCode] = $char; - } - } - - // At the end fetch all extended characters - while (!feof($fp)) { - // Get the Unicode - [$uniCode] = explode(' ', fgets($fp, 2048)); - - if (empty($uniCode)) { - continue; - } - - // Convert it if required - if (substr($uniCode, 0, 2) === '0x') { - $uniCode = hexdec(substr($uniCode, 2)); - } elseif (substr($uniCode, 0, 1) === '0' - and $uniCode !== '0' - or substr($uniCode, 0, 2) === '-0') { - $uniCode = octdec($uniCode); - } else { - $uniCode = (int) $uniCode; - } - - // Now fetch the character - $char = $this->_loadChar($fp); - - if ($char === false) { - fclose($fp); - - return; - } - - $this->_charList[$uniCode] = $char; - } - - fclose($fp); - - $this->_fontLoaded = true; - } - - /** - * Set the used smush mode, according to smush override, user smsush and - * font smush. - */ - protected function _setUsedSmush() - { - if ($this->_smushOverride === self::SMO_NO) { - $this->_smushMode = $this->_fontSmush; - } elseif ($this->_smushOverride === self::SMO_YES) { - $this->_smushMode = $this->_userSmush; - } elseif ($this->_smushOverride === self::SMO_FORCE) { - $this->_smushMode = ($this->_fontSmush | $this->_userSmush); - } - } - - /** - * Reads a four-character magic string from a stream. - * - * @param resource $fp File pointer to the font file - * - * @return string - */ - protected function _readMagic($fp) - { - $magic = ''; - - for ($i = 0; $i < 4; ++$i) { - $magic .= fgetc($fp); - } - - return $magic; - } - - /** - * Skip a stream to the end of line. - * - * @param resource $fp File pointer to the font file - */ - protected function _skipToEol($fp) - { - $dummy = fgetc($fp); - while ($dummy !== false && !feof($fp)) { - if ($dummy === "\n") { - return; - } - - if ($dummy === "\r") { - $dummy = fgetc($fp); - - if (!feof($fp) && $dummy !== "\n") { - fseek($fp, -1, SEEK_SET); - } - - return; - } - - $dummy = fgetc($fp); - } - } - - /** - * Load a single character from the font file. - * - * @param resource $fp File pointer to the font file - * - * @return array - */ - protected function _loadChar($fp) - { - $char = []; - - for ($i = 0; $i < $this->_charHeight; ++$i) { - if (feof($fp)) { - return false; - } - - $line = rtrim(fgets($fp, 2048), "\r\n"); - - if (preg_match('#(.)\\1?$#', $line, $result) === 1) { - $line = str_replace($result[1], '', $line); - } - - $char[] = $line; - } - - return $char; - } - - /** - * Unicode compatible ord() method. - * - * @param string $c The char to get the value from - * - * @return int - */ - protected function _uniOrd($c) - { - $h = ord($c[0]); - - if ($h <= 0x7F) { - $ord = $h; - } elseif ($h < 0xC2) { - $ord = 0; - } elseif ($h <= 0xDF) { - $ord = (($h & 0x1F) << 6 | (ord($c[1]) & 0x3F)); - } elseif ($h <= 0xEF) { - $ord = (($h & 0x0F) << 12 | (ord($c[1]) & 0x3F) << 6 | (ord($c[2]) & 0x3F)); - } elseif ($h <= 0xF4) { - $ord = (($h & 0x0F) << 18 | (ord($c[1]) & 0x3F) << 12 - | (ord($c[2]) & 0x3F) << 6 | (ord($c[3]) & 0x3F)); - } else { - $ord = 0; - } - - return $ord; - } -} diff --git a/library/Zend/Text/Figlet/Exception.php b/library/Zend/Text/Figlet/Exception.php deleted file mode 100644 index 55404f49d..000000000 --- a/library/Zend/Text/Figlet/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ -# - # - # - # - # - # - ## -?# - # - # - # - # - # - ## -@# - # - # - # - # - # - ## - ___ # - / _ \\ # - / //\ \\ # -| ___ ||# -|_|| |_||# -`-` `-` # - ## - ______ # -| \\ # -| --$ // # -| -- \\ # -|______// # -`------` # - ## - _____ # - / ____|| # -/ //---`' # -\ \\___ # - \_____|| # - `----` # - ## - _____ # -| __ \\ # -| |$ \ || # -| |__/ || # -|_____// # - -----` # - ## - _____ # - | ___|| # - | ||__ # - | ||__ # - |_____|| # - `-----` # - ## - ______ # - /_____// # - `____ ` # - /___// # - `__ ` # - /_// # - `-` ## - _____ # - / ___|| # -| //$__ # -| \\_\ || # - \____// # - `---` # - ## - __ _ # -| || | || # -| '--' || # -| .--. || # -|_|| |_|| # -`-` `-` # - ## - ______ # - /_ _// # - -| ||- # - _| ||_ # - /_____// # - `-----` # - ## - ______ # - /_ _// # - | || # - _| || # - /__// # - `--` # - ## - _ __ # - | |/ // # - | ' // # - | . \\ # - |_|\_\\ # - `-` --` # - ## - __ # - | || # - | || # - | ||__ # - |____// # - `----` # - ## - _ _ # -| \ / || # -| \/ || # -| . . || # -|_|\/|_|| # -`-` `-` # - ## - _ _ # - | \| || # - | ' || # - | . || # - |_|\_|| # - `-` -` # - ## - ___ # - / _ \\ # - | /$\ || # - | \_/ || # - \___// # - `---` # - ## - ____ # - | _ \\ # - | |_| || # - | .__// # - |_|--` # - `-` # - ## - ___ # - / _ \\ # -| /$\ || # -| \_/ || # - \___ \\ # - `---` # - ## - ____ # - | _ \\ # - | |_| || # - | . // # - |_|\_\\ # - `-` --` # - ## - _____ # - / ___// # - \___ \\ # - / $ // # - /____// # -`-----` # - ## - ______ # - /_ _// # - `-| |,- # - | || # - |_|| # - `-`' # - ## - _ _ # -| || | || # -| || | || # -| \\_/ || # - \____// # - `---` # - ## -__ __ # -\ \\ / // # - \ \/ // # - \ // # - \// # - ` # - ## - _ _ # -| | | || # -| |/\| || # -| /\ || # -|_// \_|| # -`-` `-` # - ## - __ __ # - \ \\/ // # - \ $ // # - / . \\ # - /_//\_\\ # - `-` --` # - ## - __ __ # - \ \\/ // # - \ ` // # - | || # - |_|| # - `-`' # - ## - ______ # -|____ // # - / // # - / // # - / //__ # -/______|| # -`------` ## -[# - # - # - # - # - # - ## -\# - # - # - # - # - # - ## -]# - # - # - # - # - # - ## -^# - # - # - # - # - # - ## -_# - # - # - # - # - # - ## -`# - # - # - # - # - # - ## - ___ # - / _ \\ # - / //\ \\ # -| ___ ||# -|_|| |_||# -`-` `-` # - ## - ______ # -| \\ # -| --$ // # -| -- \\ # -|______// # -`------` # - ## - _____ # - / ____|| # -/ //---`' # -\ \\___ # - \_____|| # - `----` # - ## - _____ # -| __ \\ # -| |$ \ || # -| |__/ || # -|_____// # - -----` # - ## - _____ # - | ___|| # - | ||__ # - | ||__ # - |_____|| # - `-----` # - ## - ______ # - /_____// # - `____ ` # - /___// # - `__ ` # - /_// # - `-` ## - _____ # - / ___|| # -| //$__ # -| \\_\ || # - \____// # - `---` # - ## - __ _ # -| || | || # -| '--' || # -| .--. || # -|_|| |_|| # -`-` `-` # - ## - ______ # - /_ _// # - -| ||- # - _| ||_ # - /_____// # - `-----` # - ## - ______ # - /_ _// # - | || # - _| || # - /__// # - `--` # - ## - _ __ # - | |/ // # - | ' // # - | . \\ # - |_|\_\\ # - `-` --` # - ## - __ # - | || # - | || # - | ||__ # - |____// # - `----` # - ## - _ _ # -| \ / || # -| \/ || # -| . . || # -|_|\/|_|| # -`-` `-` # - ## - _ _ # - | \| || # - | ' || # - | . || # - |_|\_|| # - `-` -` # - ## - ___ # - / _ \\ # - | /$\ || # - | \_/ || # - \___// # - `---` # - ## - # - ____ # - | \\ # - | [] || # - | __// # - |_|`-` # - `-` ## - # - ___ # - / || # - | [] || # - \__ || # - -|_|| # - `-` ## - ____ # - | _ \\ # - | |_| || # - | . // # - |_|\_\\ # - `-` --` # - ## - _____ # - / ___// # - \___ \\ # - / $ // # - /____// # -`-----` # - ## - ______ # - /_ _// # - `-| |,- # - | || # - |_|| # - `-`' # - ## - _ _ # -| || | || # -| || | || # -| \\_/ || # - \____// # - `---` # - ## -__ __ # -\ \\ / // # - \ \/ // # - \ // # - \// # - ` # - ## - _ _ # -| | | || # -| |/\| || # -| /\ || # -|_// \_|| # -`-` `-` # - ## - __ __ # - \ \\/ // # - \ $ // # - / . \\ # - /_//\_\\ # - `-` --` # - ## - __ __ # - \ \\/ // # - \ ` // # - | || # - |_|| # - `-`' # - ## - _____ # - |__ // # - / // # - / //__ # - /_____|| # - `-----` # - ## -{# - # - # - # - # - # - ## -|# - # - # - # - # - # - ## -}# - # - # - # - # - # - ## -~# - # - # - # - # - # - ## - []|_[]| # - / _ \\ # - / //\ \\ # -| $___$ ||# -|_||$ |_||# -`-` `-` # - ## - []|_[]| # - / _ \\ # - | /$\ || # - | \_/ || # - \___// # - ---` # - ## - []| []| # -| ||$| || # -| ||$| || # -| \\_/ || # - \____// # - `---` # - ## - []|_[]| # - / _ \\ # - / //\ \\ # -| $___$ ||# -|_||$ |_||# -`-` `-` # - ## - []|_[]| # - / _ \\ # - | /$\ || # - | \_/ || # - \___// # - ---` # - ## - []| []| # -| ||$| || # -| ||$| || # -| \\_/ || # - \____// # - `---` # - ## - ,--. # - | _$ \\ # - | // # - | |\ \\ # - |$ ___\\ # - |_|----` # - - ## -162 CENT SIGN - _ # - | || # - / __// # -| (__` # - \ \\ # - |_|` # - `-` ## -215 MULTIPLICATION SIGN - # - # - \\// # - \\ # - //\\ # - # - ## diff --git a/library/Zend/Translate.php b/library/Zend/Translate.php deleted file mode 100644 index 51492ba03..000000000 --- a/library/Zend/Translate.php +++ /dev/null @@ -1,208 +0,0 @@ -toArray(); - } elseif (func_num_args() > 1) { - $args = func_get_args(); - $options = []; - $options['adapter'] = array_shift($args); - if (!empty($args)) { - $options['content'] = array_shift($args); - } - - if (!empty($args)) { - $options['locale'] = array_shift($args); - } - - if (!empty($args)) { - $opt = array_shift($args); - $options = array_merge($opt, $options); - } - } elseif (!is_array($options)) { - $options = ['adapter' => $options]; - } - - $this->setAdapter($options); - } - - /** - * Sets a new adapter. - * - * @param array|Zend_Config|Zend_Translate_Adapter $options Options to use - * @param array|string [$content] Path to content, or content itself - * @param string|Zend_Locale [$locale] - */ - public function setAdapter($options = []) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (func_num_args() > 1) { - $args = func_get_args(); - $options = []; - $options['adapter'] = array_shift($args); - if (!empty($args)) { - $options['content'] = array_shift($args); - } - - if (!empty($args)) { - $options['locale'] = array_shift($args); - } - - if (!empty($args)) { - $opt = array_shift($args); - $options = array_merge($opt, $options); - } - } elseif (!is_array($options)) { - $options = ['adapter' => $options]; - } - - if (Zend_Loader::isReadable('Zend/Translate/Adapter/' . ucfirst($options['adapter']) . '.php')) { - $options['adapter'] = 'Zend_Translate_Adapter_' . ucfirst($options['adapter']); - } - - if (!class_exists($options['adapter'])) { - Zend_Loader::loadClass($options['adapter']); - } - - if (array_key_exists('cache', $options)) { - Zend_Translate_Adapter::setCache($options['cache']); - } - - $adapter = $options['adapter']; - unset($options['adapter']); - $this->_adapter = new $adapter($options); - if (!$this->_adapter instanceof Zend_Translate_Adapter) { - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception('Adapter ' . $adapter . ' does not extend Zend_Translate_Adapter'); - } - } - - /** - * Returns the adapters name and it's options. - * - * @return Zend_Translate_Adapter - */ - public function getAdapter() - { - return $this->_adapter; - } - - /** - * Returns the set cache. - * - * @return Zend_Cache_Core The set cache - */ - public static function getCache() - { - return Zend_Translate_Adapter::getCache(); - } - - /** - * Sets a cache for all instances of Zend_Translate. - * - * @param Zend_Cache_Core $cache Cache to store to - */ - public static function setCache(Zend_Cache_Core $cache) - { - Zend_Translate_Adapter::setCache($cache); - } - - /** - * Returns true when a cache is set. - * - * @return bool - */ - public static function hasCache() - { - return Zend_Translate_Adapter::hasCache(); - } - - /** - * Removes any set cache. - */ - public static function removeCache() - { - Zend_Translate_Adapter::removeCache(); - } - - /** - * Clears all set cache data. - * - * @param string $tag Tag to clear when the default tag name is not used - */ - public static function clearCache($tag = null) - { - Zend_Translate_Adapter::clearCache($tag); - } - - /** - * Calls all methods from the adapter. - * - * @param mixed $method - */ - public function __call($method, array $options) - { - if (method_exists($this->_adapter, $method)) { - return call_user_func_array([$this->_adapter, $method], $options); - } - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception("Unknown method '" . $method . "' called!"); - } -} diff --git a/library/Zend/Translate/Adapter.php b/library/Zend/Translate/Adapter.php deleted file mode 100644 index ca397e46b..000000000 --- a/library/Zend/Translate/Adapter.php +++ /dev/null @@ -1,1022 +0,0 @@ - when true, clears already loaded translations when adding new files - * 'content' => content to translate or file or directory with content - * 'disableNotices' => when true, omits notices from being displayed - * 'ignore' => a prefix for files and directories which are not being added - * 'locale' => the actual set locale to use - * 'log' => a instance of Zend_Log where logs are written to - * 'logMessage' => message to be logged - * 'logPriority' => priority which is used to write the log message - * 'logUntranslated' => when true, untranslated messages are not logged - * 'reload' => reloads the cache by reading the content again - * 'scan' => searches for translation files using the LOCALE constants - * 'tag' => tag to use for the cache. - * - * @var array - */ - protected $_options = [ - 'clear' => false, - 'content' => null, - 'disableNotices' => false, - 'ignore' => '.', - 'locale' => 'auto', - 'log' => null, - 'logMessage' => "Untranslated message within '%locale%': %message%", - 'logPriority' => 5, - 'logUntranslated' => false, - 'reload' => false, - 'route' => null, - 'scan' => null, - 'tag' => 'Zend_Translate', - ]; - - /** - * Translation table. - * - * @var array - */ - protected $_translate = []; - - /** - * Generates the adapter. - * - * @param array|string|Zend_Config $options Translation options for this adapter - * @param array|string [$content] - * @param string|Zend_Locale [$locale] - */ - public function __construct($options = []) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (func_num_args() > 1) { - $args = func_get_args(); - $options = []; - $options['content'] = array_shift($args); - - if (!empty($args)) { - $options['locale'] = array_shift($args); - } - - if (!empty($args)) { - $opt = array_shift($args); - $options = array_merge($opt, $options); - } - } elseif (!is_array($options)) { - $options = ['content' => $options]; - } - - if (array_key_exists('cache', $options)) { - self::setCache($options['cache']); - unset($options['cache']); - } - - if (isset(self::$_cache)) { - $id = 'Zend_Translate_' . $this->toString() . '_Options'; - $result = self::$_cache->load($id); - if ($result) { - $this->_options = $result; - } - } - - if (empty($options['locale']) || ($options['locale'] === 'auto')) { - $this->_automatic = true; - } else { - $this->_automatic = false; - } - - $locale = null; - if (!empty($options['locale'])) { - $locale = $options['locale']; - unset($options['locale']); - } - - $this->setOptions($options); - $options['locale'] = $locale; - - if (!empty($options['content'])) { - $this->addTranslation($options); - } - - if ($this->getLocale() !== (string) $options['locale']) { - $this->setLocale($options['locale']); - } - } - - /** - * Add translations. - * - * This may be a new language or additional content for an existing language - * If the key 'clear' is true, then translations for the specified - * language will be replaced and added otherwise - * - * @param array|Zend_Config $options Options and translations to be added - * - * @return Zend_Translate_Adapter Provides fluent interface - */ - public function addTranslation($options = []) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (func_num_args() > 1) { - $args = func_get_args(); - $options = []; - $options['content'] = array_shift($args); - - if (!empty($args)) { - $options['locale'] = array_shift($args); - } - - if (!empty($args)) { - $opt = array_shift($args); - $options = array_merge($opt, $options); - } - } elseif (!is_array($options)) { - $options = ['content' => $options]; - } - - if (!isset($options['content']) || empty($options['content'])) { - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception("Required option 'content' is missing"); - } - - $originate = null; - if (!empty($options['locale'])) { - $originate = (string) $options['locale']; - } - - if ((array_key_exists('log', $options)) && !($options['log'] instanceof Zend_Log)) { - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception('Instance of Zend_Log expected for option log'); - } - - try { - if (!($options['content'] instanceof Zend_Translate) && !($options['content'] instanceof Zend_Translate_Adapter)) { - if (empty($options['locale'])) { - $options['locale'] = null; - } - - $options['locale'] = Zend_Locale::findLocale($options['locale']); - } - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception("The given Language '{$options['locale']}' does not exist", 0, $e); - } - - $options = $options + $this->_options; - if (is_string($options['content']) and is_dir($options['content'])) { - $options['content'] = realpath($options['content']); - $prev = ''; - $iterator = new RecursiveIteratorIterator( - new RecursiveRegexIterator( - new RecursiveDirectoryIterator($options['content'], RecursiveDirectoryIterator::KEY_AS_PATHNAME), - '/^(?!.*(\.svn|\.cvs)).*$/', RecursiveRegexIterator::MATCH - ), - RecursiveIteratorIterator::SELF_FIRST - ); - - foreach ($iterator as $directory => $info) { - $file = $info->getFilename(); - if (is_array($options['ignore'])) { - foreach ($options['ignore'] as $key => $ignore) { - if (strpos($key, 'regex') !== false) { - if (preg_match($ignore, $directory)) { - // ignore files matching the given regex from option 'ignore' and all files below - continue 2; - } - } elseif (strpos($directory, DIRECTORY_SEPARATOR . $ignore) !== false) { - // ignore files matching first characters from option 'ignore' and all files below - continue 2; - } - } - } else { - if (strpos($directory, DIRECTORY_SEPARATOR . $options['ignore']) !== false) { - // ignore files matching first characters from option 'ignore' and all files below - continue; - } - } - - if ($info->isDir()) { - // pathname as locale - if (($options['scan'] === self::LOCALE_DIRECTORY) and (Zend_Locale::isLocale($file, true, false))) { - $options['locale'] = $file; - $prev = (string) $options['locale']; - } - } elseif ($info->isFile()) { - // filename as locale - if ($options['scan'] === self::LOCALE_FILENAME) { - $filename = explode('.', $file); - array_pop($filename); - $filename = implode('.', $filename); - if (Zend_Locale::isLocale((string) $filename, true, false)) { - $options['locale'] = (string) $filename; - } else { - $parts = explode('.', $file); - $parts2 = []; - foreach ($parts as $token) { - $parts2 += explode('_', $token); - } - $parts = array_merge($parts, $parts2); - $parts2 = []; - foreach ($parts as $token) { - $parts2 += explode('-', $token); - } - $parts = array_merge($parts, $parts2); - $parts = array_unique($parts); - $prev = ''; - foreach ($parts as $token) { - if (Zend_Locale::isLocale($token, true, false)) { - if (strlen($prev) <= strlen($token)) { - $options['locale'] = $token; - $prev = $token; - } - } - } - } - } - - try { - $options['content'] = $info->getPathname(); - $this->_addTranslationData($options); - } catch (Zend_Translate_Exception $e) { - // ignore failed sources while scanning - } - } - } - - unset($iterator); - } else { - $this->_addTranslationData($options); - } - - if ((isset($this->_translate[$originate]) === true) and (count($this->_translate[$originate]) > 0)) { - $this->setLocale($originate); - } - - return $this; - } - - /** - * Sets new adapter options. - * - * @param array $options Adapter options - * - * @return Zend_Translate_Adapter Provides fluent interface - */ - public function setOptions(array $options = []) - { - $change = false; - $locale = null; - foreach ($options as $key => $option) { - if ($key == 'locale') { - $locale = $option; - } elseif ((isset($this->_options[$key]) and ($this->_options[$key] != $option)) - or !isset($this->_options[$key])) { - if (($key == 'log') && !($option instanceof Zend_Log)) { - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception('Instance of Zend_Log expected for option log'); - } - - if ($key == 'cache') { - self::setCache($option); - - continue; - } - - $this->_options[$key] = $option; - $change = true; - } - } - - if ($locale !== null) { - $this->setLocale($locale); - } - - if (isset(self::$_cache) and ($change == true)) { - $id = 'Zend_Translate_' . $this->toString() . '_Options'; - if (self::$_cacheTags) { - self::$_cache->save($this->_options, $id, [$this->_options['tag']]); - } else { - self::$_cache->save($this->_options, $id); - } - } - - return $this; - } - - /** - * Returns the adapters name and it's options. - * - * @param null|string $optionKey String returns this option - * null returns all options - * - * @return null|array|int|string - */ - public function getOptions($optionKey = null) - { - if ($optionKey === null) { - return $this->_options; - } - - if (isset($this->_options[$optionKey]) === true) { - return $this->_options[$optionKey]; - } - - return null; - } - - /** - * Gets locale. - * - * @return null|string|Zend_Locale - */ - public function getLocale() - { - return $this->_options['locale']; - } - - /** - * Sets locale. - * - * @param string|Zend_Locale $locale Locale to set - * - * @return Zend_Translate_Adapter Provides fluent interface - */ - public function setLocale($locale) - { - if (($locale === 'auto') or ($locale === null)) { - $this->_automatic = true; - } else { - $this->_automatic = false; - } - - try { - $locale = Zend_Locale::findLocale($locale); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception("The given Language ({$locale}) does not exist", 0, $e); - } - - if (!isset($this->_translate[$locale])) { - $temp = explode('_', $locale); - if (!isset($this->_translate[$temp[0]]) and !isset($this->_translate[$locale])) { - if (!$this->_options['disableNotices']) { - if ($this->_options['log']) { - $this->_options['log']->log("The language '{$locale}' has to be added before it can be used.", $this->_options['logPriority']); - } -// trigger_error("The language '{$locale}' has to be added before it can be used.", E_USER_NOTICE); - } - } - - $locale = $temp[0]; - } - - if (empty($this->_translate[$locale])) { - if (!$this->_options['disableNotices']) { - if ($this->_options['log']) { - $this->_options['log']->log("No translation for the language '{$locale}' available.", $this->_options['logPriority']); - } - //trigger_error("No translation for the language '{$locale}' available.", E_USER_NOTICE); - } - } - - if ($this->_options['locale'] != $locale) { - $this->_options['locale'] = $locale; - - if (isset(self::$_cache)) { - $id = 'Zend_Translate_' . $this->toString() . '_Options'; - if (self::$_cacheTags) { - self::$_cache->save($this->_options, $id, [$this->_options['tag']]); - } else { - self::$_cache->save($this->_options, $id); - } - } - } - - return $this; - } - - /** - * Returns the available languages from this adapter. - * - * @return null|array - */ - public function getList() - { - $list = array_keys($this->_translate); - $result = null; - foreach ($list as $value) { - if (!empty($this->_translate[$value])) { - $result[$value] = $value; - } - } - - return $result; - } - - /** - * Returns the message id for a given translation - * If no locale is given, the actual language will be used. - * - * @param string $message Message to get the key for - * @param string|Zend_Locale $locale (optional) Language to return the message ids from - * - * @return array|false|string - */ - public function getMessageId($message, $locale = null) - { - if (empty($locale) or !$this->isAvailable($locale)) { - $locale = $this->_options['locale']; - } - - return array_search($message, $this->_translate[(string) $locale]); - } - - /** - * Returns all available message ids from this adapter - * If no locale is given, the actual language will be used. - * - * @param string|Zend_Locale $locale (optional) Language to return the message ids from - * - * @return array - */ - public function getMessageIds($locale = null) - { - if (empty($locale) or !$this->isAvailable($locale)) { - $locale = $this->_options['locale']; - } - - return array_keys($this->_translate[(string) $locale]); - } - - /** - * Returns all available translations from this adapter - * If no locale is given, the actual language will be used - * If 'all' is given the complete translation dictionary will be returned. - * - * @param string|Zend_Locale $locale (optional) Language to return the messages from - * - * @return array - */ - public function getMessages($locale = null) - { - if ($locale === 'all') { - return $this->_translate; - } - - if ((empty($locale) === true) or ($this->isAvailable($locale) === false)) { - $locale = $this->_options['locale']; - } - - return $this->_translate[(string) $locale]; - } - - /** - * Is the wished language available ? - * - * @see Zend_Locale - * - * @param string|Zend_Locale $locale Language to search for, identical with locale identifier, - * - * @see Zend_Locale for more information - * - * @return bool - */ - public function isAvailable($locale) - { - $return = isset($this->_translate[(string) $locale]); - - return $return; - } - - /** - * Load translation data. - * - * @param mixed $data - * @param string|Zend_Locale $locale - * @param array $options (optional) - * - * @return array - */ - abstract protected function _loadTranslationData($data, $locale, array $options = []); - - /** - * Internal function for adding translation data. - * - * This may be a new language or additional data for an existing language - * If the options 'clear' is true, then the translation data for the specified - * language is replaced and added otherwise - * - * @see Zend_Locale - * - * @param mixed $options - * - * @return Zend_Translate_Adapter Provides fluent interface - */ - private function _addTranslationData($options = []) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (func_num_args() > 1) { - $args = func_get_args(); - $options['content'] = array_shift($args); - - if (!empty($args)) { - $options['locale'] = array_shift($args); - } - - if (!empty($args)) { - $options += array_shift($args); - } - } - - if (($options['content'] instanceof Zend_Translate) || ($options['content'] instanceof Zend_Translate_Adapter)) { - $options['usetranslateadapter'] = true; - if (!empty($options['locale']) && ($options['locale'] !== 'auto')) { - $options['content'] = $options['content']->getMessages($options['locale']); - } else { - $content = $options['content']; - $locales = $content->getList(); - foreach ($locales as $locale) { - $options['locale'] = $locale; - $options['content'] = $content->getMessages($locale); - $this->_addTranslationData($options); - } - - return $this; - } - } - - try { - $options['locale'] = Zend_Locale::findLocale($options['locale']); - } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception("The given Language '{$options['locale']}' does not exist", 0, $e); - } - - if ($options['clear'] || !isset($this->_translate[$options['locale']])) { - $this->_translate[$options['locale']] = []; - } - - $read = true; - if (isset(self::$_cache)) { - $id = 'Zend_Translate_' . md5(serialize($options['content'])) . '_' . $this->toString(); - $temp = self::$_cache->load($id); - if ($temp) { - $read = false; - } - } - - if ($options['reload']) { - $read = true; - } - - if ($read) { - if (!empty($options['usetranslateadapter'])) { - $temp = [$options['locale'] => $options['content']]; - } else { - $temp = $this->_loadTranslationData($options['content'], $options['locale'], $options); - } - } - - if (empty($temp)) { - $temp = []; - } - - $keys = array_keys($temp); - foreach ($keys as $key) { - if (!isset($this->_translate[$key])) { - $this->_translate[$key] = []; - } - - if (array_key_exists($key, $temp) && is_array($temp[$key])) { - $this->_translate[$key] = $temp[$key] + $this->_translate[$key]; - } - } - - if ($this->_automatic === true) { - $find = new Zend_Locale($options['locale']); - $browser = $find->getEnvironment() + $find->getBrowser(); - arsort($browser); - foreach ($browser as $language => $quality) { - if (isset($this->_translate[$language])) { - $this->_options['locale'] = $language; - - break; - } - } - } - - if (($read) and (isset(self::$_cache))) { - $id = 'Zend_Translate_' . md5(serialize($options['content'])) . '_' . $this->toString(); - if (self::$_cacheTags) { - self::$_cache->save($temp, $id, [$this->_options['tag']]); - } else { - self::$_cache->save($temp, $id); - } - } - - return $this; - } - - /** - * Translates the given string - * returns the translation. - * - * @see Zend_Locale - * - * @param array|string $messageId Translation string, or Array for plural translations - * @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with - * locale identifier, @see Zend_Locale for more information - * - * @return string - */ - public function translate($messageId, $locale = null) - { - if ($locale === null) { - $locale = $this->_options['locale']; - } - - $plural = null; - if (is_array($messageId)) { - if (count($messageId) > 2) { - $number = array_pop($messageId); - if (!is_numeric($number)) { - $plocale = $number; - $number = array_pop($messageId); - } else { - $plocale = 'en'; - } - - $plural = $messageId; - $messageId = $messageId[0]; - } else { - $messageId = $messageId[0]; - } - } - - if (!Zend_Locale::isLocale($locale, true, false)) { - if (!Zend_Locale::isLocale($locale, false, false)) { - // language does not exist, return original string - $this->_log($messageId, $locale); - // use rerouting when enabled - if (!empty($this->_options['route'])) { - if (array_key_exists($locale, $this->_options['route']) - && !array_key_exists($locale, $this->_routed)) { - $this->_routed[$locale] = true; - - return $this->translate($messageId, $this->_options['route'][$locale]); - } - } - - $this->_routed = []; - if ($plural === null) { - return $messageId; - } - - $rule = Zend_Translate_Plural::getPlural($number, $plocale); - if (!isset($plural[$rule])) { - $rule = 0; - } - - return $plural[$rule]; - } - - $locale = new Zend_Locale($locale); - } - - $locale = (string) $locale; - if ((is_string($messageId) || is_int($messageId)) && isset($this->_translate[$locale][$messageId])) { - // return original translation - if ($plural === null) { - $this->_routed = []; - - return $this->_translate[$locale][$messageId]; - } - - $rule = Zend_Translate_Plural::getPlural($number, $locale); - if (isset($this->_translate[$locale][$plural[0]][$rule])) { - $this->_routed = []; - - return $this->_translate[$locale][$plural[0]][$rule]; - } - } elseif (strlen($locale) != 2) { - // faster than creating a new locale and separate the leading part - $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); - - if ((is_string($messageId) || is_int($messageId)) && isset($this->_translate[$locale][$messageId])) { - // return regionless translation (en_US -> en) - if ($plural === null) { - $this->_routed = []; - - return $this->_translate[$locale][$messageId]; - } - - $rule = Zend_Translate_Plural::getPlural($number, $locale); - if (isset($this->_translate[$locale][$plural[0]][$rule])) { - $this->_routed = []; - - return $this->_translate[$locale][$plural[0]][$rule]; - } - } - } - - $this->_log($messageId, $locale); - // use rerouting when enabled - if (!empty($this->_options['route'])) { - if (array_key_exists($locale, $this->_options['route']) - && !array_key_exists($locale, $this->_routed)) { - $this->_routed[$locale] = true; - - return $this->translate($messageId, $this->_options['route'][$locale]); - } - } - - $this->_routed = []; - if ($plural === null) { - return $messageId; - } - - $rule = Zend_Translate_Plural::getPlural($number, $plocale); - if (!isset($plural[$rule])) { - $rule = 0; - } - - return $plural[$rule]; - } - - /** - * Translates the given string using plural notations - * Returns the translated string. - * - * @see Zend_Locale - * - * @param string $singular Singular translation string - * @param string $plural Plural translation string - * @param int $number Number for detecting the correct plural - * @param string|Zend_Locale $locale (Optional) Locale/Language to use, identical with - * locale identifier, @see Zend_Locale for more information - * - * @return string - */ - public function plural($singular, $plural, $number, $locale = null) - { - return $this->translate([$singular, $plural, $number], $locale); - } - - /** - * Logs a message when the log option is set. - * - * @param string $message Message to log - * @param string $locale Locale to log - */ - protected function _log($message, $locale) - { - if ($this->_options['logUntranslated']) { - $message = str_replace('%message%', $message, $this->_options['logMessage']); - $message = str_replace('%locale%', $locale, $message); - if ($this->_options['log']) { - $this->_options['log']->log($message, $this->_options['logPriority']); - } else { - trigger_error($message, E_USER_NOTICE); - } - } - } - - /** - * Translates the given string - * returns the translation. - * - * @param string $messageId Translation string - * @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with locale - * identifier, @see Zend_Locale for more information - * - * @return string - */ - public function _($messageId, $locale = null) - { - return $this->translate($messageId, $locale); - } - - /** - * Checks if a string is translated within the source or not - * returns boolean. - * - * @param string $messageId Translation string - * @param bool $original (optional) Allow translation only for original language - * when true, a translation for 'en_US' would give false when it can - * be translated with 'en' only - * @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with locale identifier, - * see Zend_Locale for more information - * - * @return bool - */ - public function isTranslated($messageId, $original = false, $locale = null) - { - if (($original !== false) and ($original !== true)) { - $locale = $original; - $original = false; - } - - if ($locale === null) { - $locale = $this->_options['locale']; - } - - if (!Zend_Locale::isLocale($locale, true, false)) { - if (!Zend_Locale::isLocale($locale, false, false)) { - // language does not exist, return original string - return false; - } - - $locale = new Zend_Locale($locale); - } - - $locale = (string) $locale; - if ((is_string($messageId) || is_int($messageId)) && isset($this->_translate[$locale][$messageId])) { - // return original translation - return true; - } - if ((strlen($locale) != 2) and ($original === false)) { - // faster than creating a new locale and separate the leading part - $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); - - if ((is_string($messageId) || is_int($messageId)) && isset($this->_translate[$locale][$messageId])) { - // return regionless translation (en_US -> en) - return true; - } - } - - // No translation found, return original - return false; - } - - /** - * Returns the set cache. - * - * @return Zend_Cache_Core The set cache - */ - public static function getCache() - { - return self::$_cache; - } - - /** - * Sets a cache for all Zend_Translate_Adapters. - * - * @param Zend_Cache_Core $cache Cache to store to - */ - public static function setCache(Zend_Cache_Core $cache) - { - self::$_cache = $cache; - self::_getTagSupportForCache(); - } - - /** - * Returns true when a cache is set. - * - * @return bool - */ - public static function hasCache() - { - if (self::$_cache !== null) { - return true; - } - - return false; - } - - /** - * Removes any set cache. - */ - public static function removeCache() - { - self::$_cache = null; - } - - /** - * Clears all set cache data. - * - * @param string $tag Tag to clear when the default tag name is not used - */ - public static function clearCache($tag = null) - { - require_once 'Zend/Cache.php'; - if (self::$_cacheTags) { - if ($tag == null) { - $tag = 'Zend_Translate'; - } - - self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, [$tag]); - } else { - self::$_cache->clean(Zend_Cache::CLEANING_MODE_ALL); - } - } - - /** - * Returns the adapter name. - * - * @return string - */ - abstract public function toString(); - - /** - * Internal method to check if the given cache supports tags. - */ - private static function _getTagSupportForCache() - { - $backend = self::$_cache->getBackend(); - if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) { - $cacheOptions = $backend->getCapabilities(); - self::$_cacheTags = $cacheOptions['tags']; - } else { - self::$_cacheTags = false; - } - - return self::$_cacheTags; - } -} diff --git a/library/Zend/Translate/Adapter/Array.php b/library/Zend/Translate/Adapter/Array.php deleted file mode 100644 index 01b238c0f..000000000 --- a/library/Zend/Translate/Adapter/Array.php +++ /dev/null @@ -1,78 +0,0 @@ -_data = []; - if (!is_array($data)) { - if (file_exists($data)) { - ob_start(); - $data = include($data); - ob_end_clean(); - } - } - if (!is_array($data)) { - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception("Error including array or file '" . $data . "'"); - } - - if (!isset($this->_data[$locale])) { - $this->_data[$locale] = []; - } - - $this->_data[$locale] = $data + $this->_data[$locale]; - - return $this->_data; - } - - /** - * returns the adapters name. - * - * @return string - */ - public function toString() - { - return 'Array'; - } -} diff --git a/library/Zend/Translate/Exception.php b/library/Zend/Translate/Exception.php deleted file mode 100644 index 2e589c66f..000000000 --- a/library/Zend/Translate/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ - 3) { - $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); - } - - if (isset(self::$_plural[$locale])) { - $return = call_user_func(self::$_plural[$locale], $number); - - if (!is_int($return) || ($return < 0)) { - $return = 0; - } - - return $return; - } - - switch ($locale) { - case 'az': - case 'bo': - case 'dz': - case 'id': - case 'ja': - case 'jv': - case 'ka': - case 'km': - case 'kn': - case 'ko': - case 'ms': - case 'th': - case 'tr': - case 'vi': - case 'zh': - return 0; - - break; - - case 'af': - case 'bn': - case 'bg': - case 'ca': - case 'da': - case 'de': - case 'el': - case 'en': - case 'eo': - case 'es': - case 'et': - case 'eu': - case 'fa': - case 'fi': - case 'fo': - case 'fur': - case 'fy': - case 'gl': - case 'gu': - case 'ha': - case 'he': - case 'hu': - case 'is': - case 'it': - case 'ku': - case 'lb': - case 'ml': - case 'mn': - case 'mr': - case 'nah': - case 'nb': - case 'ne': - case 'nl': - case 'nn': - case 'no': - case 'om': - case 'or': - case 'pa': - case 'pap': - case 'ps': - case 'pt': - case 'so': - case 'sq': - case 'sv': - case 'sw': - case 'ta': - case 'te': - case 'tk': - case 'ur': - case 'zu': - return ($number == 1) ? 0 : 1; - - case 'am': - case 'bh': - case 'fil': - case 'fr': - case 'gun': - case 'hi': - case 'ln': - case 'mg': - case 'nso': - case 'xbr': - case 'ti': - case 'wa': - return (($number == 0) || ($number == 1)) ? 0 : 1; - - case 'be': - case 'bs': - case 'hr': - case 'ru': - case 'sr': - case 'uk': - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'cs': - case 'sk': - return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); - - case 'ga': - return ($number == 1) ? 0 : (($number == 2) ? 1 : 2); - - case 'lt': - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'sl': - return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3)); - - case 'mk': - return ($number % 10 == 1) ? 0 : 1; - - case 'mt': - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); - - case 'lv': - return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2); - - case 'pl': - return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); - - case 'cy': - return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3)); - - case 'ro': - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); - - case 'ar': - return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number >= 3) && ($number <= 10)) ? 3 : ((($number >= 11) && ($number <= 99)) ? 4 : 5)))); - - default: - return 0; - } - } - - /** - * Set's a new plural rule. - * - * @param string $rule Callback which acts as rule - * @param string $locale Locale which is used for this callback - */ - public static function setPlural($rule, $locale) - { - if ($locale == 'pt_BR') { - // temporary set a locale for brasilian - $locale = 'xbr'; - } - - if (strlen($locale) > 3) { - $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); - } - - if (!is_callable($rule)) { - require_once 'Zend/Translate/Exception.php'; - - throw new Zend_Translate_Exception('The given rule can not be called'); - } - - self::$_plural[$locale] = $rule; - } -} diff --git a/library/Zend/Uri.php b/library/Zend/Uri.php index df1db3970..8dea27c21 100644 --- a/library/Zend/Uri.php +++ b/library/Zend/Uri.php @@ -1,4 +1,5 @@ valid() === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Invalid URI supplied'); } } @@ -165,8 +154,6 @@ protected function __construct($scheme, $schemeSpecific = '') public static function fromString($uri) { if (is_string($uri) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('$uri is not a string'); } @@ -175,8 +162,6 @@ public static function fromString($uri) $schemeSpecific = isset($uri[1]) === true ? $uri[1] : ''; if (in_array($scheme, ['http', 'https']) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Invalid scheme: '$scheme'"); } @@ -196,8 +181,6 @@ protected function _parseUri($schemeSpecific) $pattern = '~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~'; $status = @preg_match($pattern, $schemeSpecific, $matches); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: scheme-specific decomposition failed'); } @@ -216,8 +199,6 @@ protected function _parseUri($schemeSpecific) $pattern = '~^(([^:@]*)(:([^@]*))?@)?((?(?=[[])[[][^]]+[]]|[^:]+))(:(.*))?$~'; $status = @preg_match($pattern, $combo, $matches); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: authority decomposition failed'); } @@ -239,8 +220,6 @@ protected function _parseUri($schemeSpecific) public function getUri() { if ($this->valid() === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('One or more parts of the URI are invalid'); } @@ -314,8 +293,6 @@ public function validateUsername($username = null) . self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $username); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: username validation failed'); } @@ -332,8 +309,6 @@ public function validateUsername($username = null) public function setUsername($username) { if ($this->validateUsername($username) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Username \"$username\" is not a valid HTTP username"); } @@ -384,8 +359,6 @@ public function validatePassword($password = null) . self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $password); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: password validation failed.'); } @@ -402,8 +375,6 @@ public function validatePassword($password = null) public function setPassword($password) { if ($this->validatePassword($password) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Password \"$password\" is not a valid HTTP password."); } @@ -460,8 +431,6 @@ public function validateHost($host = null) public function setHost($host) { if ($this->validateHost($host) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Host \"$host\" is not a valid HTTP host"); } @@ -514,8 +483,6 @@ public function validatePort($port = null) public function setPort($port) { if ($this->validatePort($port) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Port \"$port\" is not a valid HTTP port."); } @@ -558,8 +525,6 @@ public function validatePath($path = null) $pattern = '/^' . $this->_regex['path'] . '$/'; $status = @preg_match($pattern, $path); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: path validation failed'); } @@ -576,8 +541,6 @@ public function validatePath($path = null) public function setPath($path) { if ($this->validatePath($path) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Path \"$path\" is not a valid HTTP path"); } @@ -640,8 +603,6 @@ public function validateQuery($query = null) $pattern = '/^' . $this->_regex['uric'] . '*$/'; $status = @preg_match($pattern, $query); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: query validation failed'); } @@ -707,8 +668,6 @@ public function setQuery($query) // Make sure the query is valid, and set it if ($this->validateQuery($query) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("'$query' is not a valid query string"); } @@ -752,8 +711,6 @@ public function validateFragment($fragment = null) $pattern = '/^' . $this->_regex['uric'] . '*$/'; $status = @preg_match($pattern, $fragment); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: fragment validation failed'); } @@ -770,8 +727,6 @@ public function validateFragment($fragment = null) public function setFragment($fragment) { if ($this->validateFragment($fragment) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Fragment \"$fragment\" is not a valid HTTP fragment"); } diff --git a/library/Zend/Validate.php b/library/Zend/Validate.php index b0a76baf2..b7249b2b5 100644 --- a/library/Zend/Validate.php +++ b/library/Zend/Validate.php @@ -1,4 +1,5 @@ implementsInterface(\Zend_Validate_Interface::class)) { + if ($class->implementsInterface(Zend_Validate_Interface::class)) { if ($class->hasMethod('__construct')) { $keys = array_keys($args); $numeric = false; @@ -242,8 +237,6 @@ public static function is($value, $classBaseName, array $args = [], $namespaces // fallthrough and continue for missing validation classes } - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Validate class not found from basename '$classBaseName'"); } @@ -254,8 +247,6 @@ public static function is($value, $classBaseName, array $args = [], $namespaces */ public static function getMessageLength() { - require_once 'Zend/Validate/Abstract.php'; - return Zend_Validate_Abstract::getMessageLength(); } @@ -266,32 +257,6 @@ public static function getMessageLength() */ public static function setMessageLength($length = -1) { - require_once 'Zend/Validate/Abstract.php'; Zend_Validate_Abstract::setMessageLength($length); } - - /** - * Returns the default translation object. - * - * @param null|mixed $translator - * - * @return null|Zend_Translate_Adapter - */ - public static function getDefaultTranslator($translator = null) - { - require_once 'Zend/Validate/Abstract.php'; - - return Zend_Validate_Abstract::getDefaultTranslator(); - } - - /** - * Sets a default translation object for all validation objects. - * - * @param null|Zend_Translate|Zend_Translate_Adapter $translator - */ - public static function setDefaultTranslator($translator = null) - { - require_once 'Zend/Validate/Abstract.php'; - Zend_Validate_Abstract::setDefaultTranslator($translator); - } } diff --git a/library/Zend/Validate/Abstract.php b/library/Zend/Validate/Abstract.php index 356a308d1..e8a58ceb0 100644 --- a/library/Zend/Validate/Abstract.php +++ b/library/Zend/Validate/Abstract.php @@ -1,4 +1,5 @@ _messageTemplates[$messageKey])) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("No message template exists for key '$messageKey'"); } @@ -192,10 +165,6 @@ public function __get($property) if (array_key_exists($property, $this->_messageVariables)) { return $this->{$this->_messageVariables[$property]}; } - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("No property exists by the name '$property'"); } @@ -205,9 +174,6 @@ public function __get($property) * * Returns null if and only if $messageKey does not correspond to an existing template. * - * If a translator is available and a translation exists for $messageKey, - * the translation will be used. - * * @param string $messageKey * @param string $value * @@ -221,14 +187,6 @@ protected function _createMessage($messageKey, $value) $message = $this->_messageTemplates[$messageKey]; - if (null !== ($translator = $this->getTranslator())) { - if ($translator->isTranslated($messageKey)) { - $message = $translator->translate($messageKey); - } else { - $message = $translator->translate($message); - } - } - if (is_object($value)) { if (!in_array('__toString', get_class_methods($value))) { $value = get_class($value) . ' object'; @@ -347,131 +305,6 @@ public function getObscureValue() return $this->_obscureValue; } - /** - * Set translation object. - * - * @param null|Zend_Translate|Zend_Translate_Adapter $translator - * - * @return Zend_Validate_Abstract - */ - public function setTranslator($translator = null) - { - if ((null === $translator) || ($translator instanceof Zend_Translate_Adapter)) { - $this->_translator = $translator; - } elseif ($translator instanceof Zend_Translate) { - $this->_translator = $translator->getAdapter(); - } else { - require_once 'Zend/Validate/Exception.php'; - - throw new Zend_Validate_Exception('Invalid translator specified'); - } - - return $this; - } - - /** - * Return translation object. - * - * @return null|Zend_Translate_Adapter - */ - public function getTranslator() - { - if ($this->translatorIsDisabled()) { - return null; - } - - if (null === $this->_translator) { - return self::getDefaultTranslator(); - } - - return $this->_translator; - } - - /** - * Does this validator have its own specific translator? - * - * @return bool - */ - public function hasTranslator() - { - return (bool) $this->_translator; - } - - /** - * Set default translation object for all validate objects. - * - * @param null|Zend_Translate|Zend_Translate_Adapter $translator - */ - public static function setDefaultTranslator($translator = null) - { - if ((null === $translator) || ($translator instanceof Zend_Translate_Adapter)) { - self::$_defaultTranslator = $translator; - } elseif ($translator instanceof Zend_Translate) { - self::$_defaultTranslator = $translator->getAdapter(); - } else { - require_once 'Zend/Validate/Exception.php'; - - throw new Zend_Validate_Exception('Invalid translator specified'); - } - } - - /** - * Get default translation object for all validate objects. - * - * @return null|Zend_Translate_Adapter - */ - public static function getDefaultTranslator() - { - if (null === self::$_defaultTranslator) { - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered(\Zend_Translate::class)) { - $translator = Zend_Registry::get(\Zend_Translate::class); - if ($translator instanceof Zend_Translate_Adapter) { - return $translator; - } - if ($translator instanceof Zend_Translate) { - return $translator->getAdapter(); - } - } - } - - return self::$_defaultTranslator; - } - - /** - * Is there a default translation object set? - * - * @return bool - */ - public static function hasDefaultTranslator() - { - return (bool) self::$_defaultTranslator; - } - - /** - * Indicate whether or not translation should be disabled. - * - * @param bool $flag - * - * @return Zend_Validate_Abstract - */ - public function setDisableTranslator($flag) - { - $this->_translatorDisabled = (bool) $flag; - - return $this; - } - - /** - * Is translation disabled? - * - * @return bool - */ - public function translatorIsDisabled() - { - return $this->_translatorDisabled; - } - /** * Returns the maximum allowed message length. * diff --git a/library/Zend/Validate/Alnum.php b/library/Zend/Validate/Alnum.php index 929a66752..0881f9c0a 100644 --- a/library/Zend/Validate/Alnum.php +++ b/library/Zend/Validate/Alnum.php @@ -1,4 +1,5 @@ "'%value%' failed checksum validation", - self::INVALID_CHARS => "'%value%' contains invalid characters", - self::INVALID_LENGTH => "'%value%' should have a length of %length% characters", - self::INVALID => 'Invalid type given. String expected', - ]; - - /** - * Additional variables available for validation failure messages. - * - * @var array - */ - protected $_messageVariables = [ - 'length' => '_length', - ]; - - /** - * Length for the set subtype. - * - * @var int - */ - protected $_length; - - /** - * Barcode adapter. - * - * @var Zend_Validate_Barcode_BarcodeAdapter - */ - protected $_adapter; - - /** - * Generates the standard validator object. - * - * @param string|Zend_Config| - * Zend_Validate_Barcode_BarcodeAdapter $adapter Barcode adapter to use - */ - public function __construct($adapter) - { - if ($adapter instanceof Zend_Config) { - $adapter = $adapter->toArray(); - } - - $options = null; - $checksum = null; - if (is_array($adapter)) { - if (array_key_exists('options', $adapter)) { - $options = $adapter['options']; - } - - if (array_key_exists('checksum', $adapter)) { - $checksum = $adapter['checksum']; - } - - if (array_key_exists('adapter', $adapter)) { - $adapter = $adapter['adapter']; - } else { - require_once 'Zend/Validate/Exception.php'; - - throw new Zend_Validate_Exception("Missing option 'adapter'"); - } - } - - $this->setAdapter($adapter, $options); - if ($checksum !== null) { - $this->setChecksum($checksum); - } - } - - /** - * Returns the set adapter. - * - * @return Zend_Validate_Barcode_BarcodeAdapter - */ - public function getAdapter() - { - return $this->_adapter; - } - - /** - * Sets a new barcode adapter. - * - * @param string|Zend_Validate_Barcode $adapter Barcode adapter to use - * @param array $options Options for this adapter - * - * @return $this - */ - public function setAdapter($adapter, $options = null) - { - $adapter = ucfirst(strtolower($adapter)); - require_once 'Zend/Loader.php'; - if (Zend_Loader::isReadable('Zend/Validate/Barcode/' . $adapter . '.php')) { - $adapter = 'Zend_Validate_Barcode_' . $adapter; - } - - if (!class_exists($adapter)) { - Zend_Loader::loadClass($adapter); - } - - $this->_adapter = new $adapter($options); - if (!$this->_adapter instanceof Zend_Validate_Barcode_AdapterInterface) { - require_once 'Zend/Validate/Exception.php'; - - throw new Zend_Validate_Exception( - 'Adapter ' . $adapter . ' does not implement Zend_Validate_Barcode_AdapterInterface' - ); - } - - return $this; - } - - /** - * Returns the checksum option. - * - * @return bool - */ - public function getChecksum() - { - return $this->getAdapter()->getCheck(); - } - - /** - * Sets the checksum option. - * - * @param bool $checksum - * - * @return Zend_Validate_Barcode - */ - public function setChecksum($checksum) - { - $this->getAdapter()->setCheck($checksum); - - return $this; - } - - /** - * Defined by Zend_Validate_Interface. - * - * Returns true if and only if $value contains a valid barcode - * - * @param string $value - * - * @return bool - */ - public function isValid($value) - { - if (!is_string($value)) { - $this->_error(self::INVALID); - - return false; - } - - $this->_setValue($value); - $adapter = $this->getAdapter(); - $this->_length = $adapter->getLength(); - $result = $adapter->checkLength($value); - if (!$result) { - if (is_array($this->_length)) { - $temp = $this->_length; - $this->_length = ''; - foreach ($temp as $length) { - $this->_length .= '/'; - $this->_length .= $length; - } - - $this->_length = substr($this->_length, 1); - } - - $this->_error(self::INVALID_LENGTH); - - return false; - } - - $result = $adapter->checkChars($value); - if (!$result) { - $this->_error(self::INVALID_CHARS); - - return false; - } - - if ($this->getChecksum()) { - $result = $adapter->checksum($value); - if (!$result) { - $this->_error(self::FAILED); - - return false; - } - } - - return true; - } -} diff --git a/library/Zend/Validate/Barcode/AdapterAbstract.php b/library/Zend/Validate/Barcode/AdapterAbstract.php deleted file mode 100644 index b5ed17692..000000000 --- a/library/Zend/Validate/Barcode/AdapterAbstract.php +++ /dev/null @@ -1,322 +0,0 @@ -getLength(); - if (is_array($length)) { - foreach ($length as $value) { - if ($fixum == $value) { - $found = true; - } - - if ($value == -1) { - $found = true; - } - } - } elseif ($fixum == $length) { - $found = true; - } elseif ($length == -1) { - $found = true; - } elseif ($length == 'even') { - $count = $fixum % 2; - $found = ($count == 0) ? true : false; - } elseif ($length == 'odd') { - $count = $fixum % 2; - $found = ($count == 1) ? true : false; - } - - return $found; - } - - /** - * Checks for allowed characters within the barcode. - * - * @param string $value The barcode to check for allowed characters - * - * @return bool - */ - public function checkChars($value) - { - if (!is_string($value)) { - return false; - } - - $characters = $this->getCharacters(); - if ($characters == 128) { - for ($x = 0; $x < 128; ++$x) { - $value = str_replace(chr($x), '', $value); - } - } else { - $chars = str_split($characters); - foreach ($chars as $char) { - $value = str_replace($char, '', $value); - } - } - - if (strlen($value) > 0) { - return false; - } - - return true; - } - - /** - * Validates the checksum. - * - * @param string $value The barcode to check the checksum for - * - * @return bool - */ - public function checksum($value) - { - $checksum = $this->getChecksum(); - if (!empty($checksum)) { - if (method_exists($this, $checksum)) { - return call_user_func([$this, $checksum], $value); - } - } - - return false; - } - - /** - * Returns the allowed barcode length. - * - * @return string - */ - public function getLength() - { - return $this->_length; - } - - /** - * Returns the allowed characters. - * - * @return int|string - */ - public function getCharacters() - { - return $this->_characters; - } - - /** - * Returns the checksum function name. - */ - public function getChecksum() - { - return $this->_checksum; - } - - /** - * Returns if barcode uses checksum. - * - * @return bool - */ - public function getCheck() - { - return $this->_hasChecksum; - } - - /** - * Sets the checksum validation. - * - * @param bool $check - * - * @return Zend_Validate_Barcode_AdapterAbstract - */ - public function setCheck($check) - { - $this->_hasChecksum = (boolean) $check; - - return $this; - } - - /** - * Validates the checksum (Modulo 10) - * GTIN implementation factor 3. - * - * @param string $value The barcode to validate - * - * @return bool - */ - protected function _gtin($value) - { - $barcode = substr($value, 0, -1); - $sum = 0; - $length = strlen($barcode) - 1; - - for ($i = 0; $i <= $length; ++$i) { - if (($i % 2) === 0) { - $sum += $barcode[$length - $i] * 3; - } else { - $sum += $barcode[$length - $i]; - } - } - - $calc = $sum % 10; - $checksum = ($calc === 0) ? 0 : (10 - $calc); - if ($value[$length + 1] != $checksum) { - return false; - } - - return true; - } - - /** - * Validates the checksum (Modulo 10) - * IDENTCODE implementation factors 9 and 4. - * - * @param string $value The barcode to validate - * - * @return bool - */ - protected function _identcode($value) - { - $barcode = substr($value, 0, -1); - $sum = 0; - $length = strlen($value) - 2; - - for ($i = 0; $i <= $length; ++$i) { - if (($i % 2) === 0) { - $sum += $barcode[$length - $i] * 4; - } else { - $sum += $barcode[$length - $i] * 9; - } - } - - $calc = $sum % 10; - $checksum = ($calc === 0) ? 0 : (10 - $calc); - if ($value[$length + 1] != $checksum) { - return false; - } - - return true; - } - - /** - * Validates the checksum (Modulo 10) - * CODE25 implementation factor 3. - * - * @param string $value The barcode to validate - * - * @return bool - */ - protected function _code25($value) - { - $barcode = substr($value, 0, -1); - $sum = 0; - $length = strlen($barcode) - 1; - - for ($i = 0; $i <= $length; ++$i) { - if (($i % 2) === 0) { - $sum += $barcode[$i] * 3; - } else { - $sum += $barcode[$i]; - } - } - - $calc = $sum % 10; - $checksum = ($calc === 0) ? 0 : (10 - $calc); - if ($value[$length + 1] != $checksum) { - return false; - } - - return true; - } - - /** - * Validates the checksum () - * POSTNET implementation. - * - * @param string $value The barcode to validate - * - * @return bool - */ - protected function _postnet($value) - { - $checksum = substr($value, -1, 1); - $values = str_split(substr($value, 0, -1)); - - $check = 0; - foreach ($values as $row) { - $check += $row; - } - - $check %= 10; - $check = 10 - $check; - if ($check == $checksum) { - return true; - } - - return false; - } -} diff --git a/library/Zend/Validate/Barcode/AdapterInterface.php b/library/Zend/Validate/Barcode/AdapterInterface.php deleted file mode 100644 index c685122ed..000000000 --- a/library/Zend/Validate/Barcode/AdapterInterface.php +++ /dev/null @@ -1,67 +0,0 @@ -setCheck(false); - } -} diff --git a/library/Zend/Validate/Barcode/Code25interleaved.php b/library/Zend/Validate/Barcode/Code25interleaved.php deleted file mode 100644 index 444e60a3e..000000000 --- a/library/Zend/Validate/Barcode/Code25interleaved.php +++ /dev/null @@ -1,61 +0,0 @@ -setCheck(false); - } -} diff --git a/library/Zend/Validate/Barcode/Code39.php b/library/Zend/Validate/Barcode/Code39.php deleted file mode 100644 index 3da8bf001..000000000 --- a/library/Zend/Validate/Barcode/Code39.php +++ /dev/null @@ -1,98 +0,0 @@ - 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, - '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, - 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, - 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, - 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34, - 'Z' => 35, '-' => 36, '.' => 37, ' ' => 38, '$' => 39, '/' => 40, '+' => 41, - '%' => 42, - ]; - - /** - * Constructor. - * - * Sets check flag to false. - */ - public function __construct() - { - $this->setCheck(false); - } - - /** - * Validates the checksum (Modulo 43). - * - * @param string $value The barcode to validate - * - * @return bool - */ - protected function _code39($value) - { - $checksum = substr($value, -1, 1); - $value = str_split(substr($value, 0, -1)); - $count = 0; - foreach ($value as $char) { - $count += $this->_check[$char]; - } - - $mod = $count % 43; - if ($mod == $this->_check[$checksum]) { - return true; - } - - return false; - } -} diff --git a/library/Zend/Validate/Barcode/Code39ext.php b/library/Zend/Validate/Barcode/Code39ext.php deleted file mode 100644 index 1cdfa7839..000000000 --- a/library/Zend/Validate/Barcode/Code39ext.php +++ /dev/null @@ -1,54 +0,0 @@ -setCheck(false); - } -} diff --git a/library/Zend/Validate/Barcode/Code93.php b/library/Zend/Validate/Barcode/Code93.php deleted file mode 100644 index 34c886ba3..000000000 --- a/library/Zend/Validate/Barcode/Code93.php +++ /dev/null @@ -1,119 +0,0 @@ - 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, - '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, - 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, - 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, - 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34, - 'Z' => 35, '-' => 36, '.' => 37, ' ' => 38, '$' => 39, '/' => 40, '+' => 41, - '%' => 42, '!' => 43, '"' => 44, '§' => 45, '&' => 46, - ]; - - /** - * Constructor. - * - * Sets check flag to false. - */ - public function __construct() - { - $this->setCheck(false); - } - - /** - * Validates the checksum (Modulo CK). - * - * @param string $value The barcode to validate - * - * @return bool - */ - protected function _code93($value) - { - $checksum = substr($value, -2, 2); - $value = str_split(substr($value, 0, -2)); - $count = 0; - $length = count($value) % 20; - foreach ($value as $char) { - if ($length == 0) { - $length = 20; - } - - $count += $this->_check[$char] * $length; - --$length; - } - - $check = array_search(($count % 47), $this->_check); - $value[] = $check; - $count = 0; - $length = count($value) % 15; - foreach ($value as $char) { - if ($length == 0) { - $length = 15; - } - - $count += $this->_check[$char] * $length; - --$length; - } - $check .= array_search(($count % 47), $this->_check); - - if ($check == $checksum) { - return true; - } - - return false; - } -} diff --git a/library/Zend/Validate/Barcode/Code93ext.php b/library/Zend/Validate/Barcode/Code93ext.php deleted file mode 100644 index ff1308e42..000000000 --- a/library/Zend/Validate/Barcode/Code93ext.php +++ /dev/null @@ -1,54 +0,0 @@ -setCheck(false); - } -} diff --git a/library/Zend/Validate/Barcode/Ean12.php b/library/Zend/Validate/Barcode/Ean12.php deleted file mode 100644 index e020dbb58..000000000 --- a/library/Zend/Validate/Barcode/Ean12.php +++ /dev/null @@ -1,51 +0,0 @@ -setCheck(false); - } -} diff --git a/library/Zend/Validate/Barcode/Ean5.php b/library/Zend/Validate/Barcode/Ean5.php deleted file mode 100644 index 6296c9a9c..000000000 --- a/library/Zend/Validate/Barcode/Ean5.php +++ /dev/null @@ -1,54 +0,0 @@ -setCheck(false); - } -} diff --git a/library/Zend/Validate/Barcode/Ean8.php b/library/Zend/Validate/Barcode/Ean8.php deleted file mode 100644 index d4b44510d..000000000 --- a/library/Zend/Validate/Barcode/Ean8.php +++ /dev/null @@ -1,69 +0,0 @@ -setCheck(false); - } else { - $this->setCheck(true); - } - - return parent::checkLength($value); - } -} diff --git a/library/Zend/Validate/Barcode/Gtin12.php b/library/Zend/Validate/Barcode/Gtin12.php deleted file mode 100644 index 007f6de61..000000000 --- a/library/Zend/Validate/Barcode/Gtin12.php +++ /dev/null @@ -1,51 +0,0 @@ -setCheck(false); - } -} diff --git a/library/Zend/Validate/Barcode/Issn.php b/library/Zend/Validate/Barcode/Issn.php deleted file mode 100644 index 7f8c1cefa..000000000 --- a/library/Zend/Validate/Barcode/Issn.php +++ /dev/null @@ -1,122 +0,0 @@ -_checksum = '_issn'; - } else { - $this->_checksum = '_gtin'; - } - - return parent::checksum($value); - } - - /** - * Validates the checksum () - * ISSN implementation (reversed mod11). - * - * @param string $value The barcode to validate - * - * @return bool - */ - protected function _issn($value) - { - $checksum = substr($value, -1, 1); - $values = str_split(substr($value, 0, -1)); - $check = 0; - $multi = 8; - foreach ($values as $token) { - if ($token == 'X') { - $token = 10; - } - - $check += ($token * $multi); - --$multi; - } - - $check %= 11; - $check = 11 - $check; - if ($check == $checksum) { - return true; - } - if (($check == 10) && ($checksum == 'X')) { - return true; - } - - return false; - } -} diff --git a/library/Zend/Validate/Barcode/Itf14.php b/library/Zend/Validate/Barcode/Itf14.php deleted file mode 100644 index c8e3c9ecc..000000000 --- a/library/Zend/Validate/Barcode/Itf14.php +++ /dev/null @@ -1,51 +0,0 @@ - 1, '1' => 1, '2' => 1, '3' => 1, '4' => 1, '5' => 1, - '6' => 2, '7' => 2, '8' => 2, '9' => 2, 'A' => 2, 'B' => 2, - 'C' => 3, 'D' => 3, 'E' => 3, 'F' => 3, 'G' => 3, 'H' => 3, - 'I' => 4, 'J' => 4, 'K' => 4, 'L' => 4, 'M' => 4, 'N' => 4, - 'O' => 5, 'P' => 5, 'Q' => 5, 'R' => 5, 'S' => 5, 'T' => 5, - 'U' => 0, 'V' => 0, 'W' => 0, 'X' => 0, 'Y' => 0, 'Z' => 0, - ]; - - protected $_columns = [ - '0' => 1, '1' => 2, '2' => 3, '3' => 4, '4' => 5, '5' => 0, - '6' => 1, '7' => 2, '8' => 3, '9' => 4, 'A' => 5, 'B' => 0, - 'C' => 1, 'D' => 2, 'E' => 3, 'F' => 4, 'G' => 5, 'H' => 0, - 'I' => 1, 'J' => 2, 'K' => 3, 'L' => 4, 'M' => 5, 'N' => 0, - 'O' => 1, 'P' => 2, 'Q' => 3, 'R' => 4, 'S' => 5, 'T' => 0, - 'U' => 1, 'V' => 2, 'W' => 3, 'X' => 4, 'Y' => 5, 'Z' => 0, - ]; - - /** - * Checksum function. - * - * @var string - */ - protected $_checksum = '_royalmail'; - - /** - * Validates the checksum (). - * - * @param string $value The barcode to validate - * - * @return bool - */ - protected function _royalmail($value) - { - $checksum = substr($value, -1, 1); - $values = str_split(substr($value, 0, -1)); - $rowvalue = 0; - $colvalue = 0; - foreach ($values as $row) { - $rowvalue += $this->_rows[$row]; - $colvalue += $this->_columns[$row]; - } - - $rowvalue %= 6; - $colvalue %= 6; - - $rowchkvalue = array_keys($this->_rows, $rowvalue); - $colchkvalue = array_keys($this->_columns, $colvalue); - $chkvalue = current(array_intersect($rowchkvalue, $colchkvalue)); - if ($chkvalue == $checksum) { - return true; - } - - return false; - } - - /** - * Allows start and stop tag within checked chars. - * - * @param string $value The barcode to check for allowed characters - * - * @return bool - */ - public function checkChars($value) - { - if ($value[0] == '(') { - $value = substr($value, 1); - - if ($value[strlen($value) - 1] == ')') { - $value = substr($value, 0, -1); - } else { - return false; - } - } - - return parent::checkChars($value); - } -} diff --git a/library/Zend/Validate/Barcode/Sscc.php b/library/Zend/Validate/Barcode/Sscc.php deleted file mode 100644 index 921c107e0..000000000 --- a/library/Zend/Validate/Barcode/Sscc.php +++ /dev/null @@ -1,51 +0,0 @@ -setCheck(false); - } else { - $this->setCheck(true); - } - - return parent::checkLength($value); - } -} diff --git a/library/Zend/Validate/Between.php b/library/Zend/Validate/Between.php index e9a1afbee..06967786f 100644 --- a/library/Zend/Validate/Between.php +++ b/library/Zend/Validate/Between.php @@ -1,4 +1,5 @@ getCallback())) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('No callback registered'); } } @@ -107,8 +101,6 @@ public function getCallback() public function setCallback($callback) { if (!is_callable($callback)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid callback given'); } $this->_callback = $callback; diff --git a/library/Zend/Validate/Ccnum.php b/library/Zend/Validate/Ccnum.php index 876918d8d..0df6e6e3f 100644 --- a/library/Zend/Validate/Ccnum.php +++ b/library/Zend/Validate/Ccnum.php @@ -1,4 +1,5 @@ _setValue($value); if (null === self::$_filter) { - /** - * @see Zend_Filter_Digits - */ - require_once 'Zend/Filter/Digits.php'; + // @see Zend_Filter_Digits self::$_filter = new Zend_Filter_Digits(); } diff --git a/library/Zend/Validate/CreditCard.php b/library/Zend/Validate/CreditCard.php index a5b4f5fa5..8124040bb 100644 --- a/library/Zend/Validate/CreditCard.php +++ b/library/Zend/Validate/CreditCard.php @@ -1,4 +1,5 @@ _service)) { try { - require_once 'Zend/Validate/Callback.php'; $callback = new Zend_Validate_Callback($this->_service); $callback->setOptions($this->_type); if (!$callback->isValid($value)) { diff --git a/library/Zend/Validate/Date.php b/library/Zend/Validate/Date.php deleted file mode 100644 index d3e0b8f50..000000000 --- a/library/Zend/Validate/Date.php +++ /dev/null @@ -1,265 +0,0 @@ - 'Invalid type given. String, integer, array or Zend_Date expected', - self::INVALID_DATE => "'%value%' does not appear to be a valid date", - self::FALSEFORMAT => "'%value%' does not fit the date format '%format%'", - ]; - - /** - * @var array - */ - protected $_messageVariables = [ - 'format' => '_format', - ]; - - /** - * Optional format. - * - * @var null|string - */ - protected $_format; - - /** - * Optional locale. - * - * @var null|string|Zend_Locale - */ - protected $_locale; - - /** - * Sets validator options. - * - * @param array|string|Zend_Config $options OPTIONAL - */ - public function __construct($options = []) - { - $temp = []; - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (!is_array($options)) { - $options = func_get_args(); - $temp['format'] = array_shift($options); - if (!empty($options)) { - $temp['locale'] = array_shift($options); - } - - $options = $temp; - } - - if (array_key_exists('format', $options)) { - $this->setFormat($options['format']); - } - - if (!array_key_exists('locale', $options)) { - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered(\Zend_Locale::class)) { - $options['locale'] = Zend_Registry::get(\Zend_Locale::class); - } - } - - if (array_key_exists('locale', $options)) { - $this->setLocale($options['locale']); - } - } - - /** - * Returns the locale option. - * - * @return null|string|Zend_Locale - */ - public function getLocale() - { - return $this->_locale; - } - - /** - * Sets the locale option. - * - * @param string|Zend_Locale $locale - * - * @return Zend_Validate_Date provides a fluent interface - */ - public function setLocale($locale = null) - { - require_once 'Zend/Locale.php'; - $this->_locale = Zend_Locale::findLocale($locale); - - return $this; - } - - /** - * Returns the locale option. - * - * @return null|string - */ - public function getFormat() - { - return $this->_format; - } - - /** - * Sets the format option. - * - * @param string $format - * - * @return Zend_Validate_Date provides a fluent interface - */ - public function setFormat($format = null) - { - $this->_format = $format; - - return $this; - } - - /** - * Defined by Zend_Validate_Interface. - * - * Returns true if $value is a valid date of the format YYYY-MM-DD - * If optional $format or $locale is set the date format is checked - * according to Zend_Date, see Zend_Date::isDate() - * - * @param array|string|Zend_Date $value - * - * @return bool - */ - public function isValid($value) - { - if (!is_string($value) && !is_int($value) && !is_float($value) - && !is_array($value) && !($value instanceof Zend_Date)) { - $this->_error(self::INVALID); - - return false; - } - - $this->_setValue($value); - - if (($this->_format !== null) || ($this->_locale !== null) || is_array($value) - || $value instanceof Zend_Date) { - require_once 'Zend/Date.php'; - if (!Zend_Date::isDate($value, $this->_format, $this->_locale)) { - if ($this->_checkFormat($value) === false) { - $this->_error(self::FALSEFORMAT); - } else { - $this->_error(self::INVALID_DATE); - } - - return false; - } - } else { - if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $value)) { - $this->_format = 'yyyy-MM-dd'; - $this->_error(self::FALSEFORMAT); - $this->_format = null; - - return false; - } - - [$year, $month, $day] = sscanf($value, '%d-%d-%d'); - - if (!checkdate($month, $day, $year)) { - $this->_error(self::INVALID_DATE); - - return false; - } - } - - return true; - } - - /** - * Check if the given date fits the given format. - * - * @param string $value Date to check - * - * @return bool False when date does not fit the format - */ - private function _checkFormat($value) - { - try { - require_once 'Zend/Locale/Format.php'; - $parsed = Zend_Locale_Format::getDate($value, [ - 'date_format' => $this->_format, 'format_type' => 'iso', - 'fix_date' => false, ]); - if (isset($parsed['year']) and ((strpos(strtoupper($this->_format), 'YY') !== false) - and (strpos(strtoupper($this->_format), 'YYYY') === false))) { - $parsed['year'] = Zend_Date::getFullYear($parsed['year']); - } - } catch (Exception $e) { - // Date can not be parsed - return false; - } - - if (((strpos($this->_format, 'Y') !== false) or (strpos($this->_format, 'y') !== false)) - and (!isset($parsed['year']))) { - // Year expected but not found - return false; - } - - if ((strpos($this->_format, 'M') !== false) and (!isset($parsed['month']))) { - // Month expected but not found - return false; - } - - if ((strpos($this->_format, 'd') !== false) and (!isset($parsed['day']))) { - // Day expected but not found - return false; - } - - if (((strpos($this->_format, 'H') !== false) or (strpos($this->_format, 'h') !== false)) - and (!isset($parsed['hour']))) { - // Hour expected but not found - return false; - } - - if ((strpos($this->_format, 'm') !== false) and (!isset($parsed['minute']))) { - // Minute expected but not found - return false; - } - - if ((strpos($this->_format, 's') !== false) and (!isset($parsed['second']))) { - // Second expected but not found - return false; - } - - // Date fits the format - return true; - } -} diff --git a/library/Zend/Validate/Db/Abstract.php b/library/Zend/Validate/Db/Abstract.php deleted file mode 100644 index 017758b5a..000000000 --- a/library/Zend/Validate/Db/Abstract.php +++ /dev/null @@ -1,368 +0,0 @@ - "No record matching '%value%' was found", - self::ERROR_RECORD_FOUND => "A record matching '%value%' was found", - ]; - - /** - * @var string - */ - protected $_schema; - - /** - * @var string - */ - protected $_table = ''; - - /** - * @var string - */ - protected $_field = ''; - - /** - * @var mixed - */ - protected $_exclude; - - /** - * Database adapter to use. If null isValid() will use Zend_Db::getInstance instead. - * - * @var unknown_type - */ - protected $_adapter; - - /** - * Select object to use. can be set, or will be auto-generated. - * - * @var Zend_Db_Select - */ - protected $_select; - - /** - * Provides basic configuration for use with Zend_Validate_Db Validators - * Setting $exclude allows a single record to be excluded from matching. - * Exclude can either be a String containing a where clause, or an array with `field` and `value` keys - * to define the where clause added to the sql. - * A database adapter may optionally be supplied to avoid using the registered default adapter. - * - * The following option keys are supported: - * 'table' => The database table to validate against - * 'schema' => The schema keys - * 'field' => The field to check for a match - * 'exclude' => An optional where clause or field/value pair to exclude from the query - * 'adapter' => An optional database adapter to use - * - * @param array|Zend_Config $options Options to use for this validator - */ - public function __construct($options) - { - $temp = []; - if ($options instanceof Zend_Db_Select) { - $this->setSelect($options); - - return; - } - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (func_num_args() > 1) { - $options = func_get_args(); - $temp['table'] = array_shift($options); - $temp['field'] = array_shift($options); - if (!empty($options)) { - $temp['exclude'] = array_shift($options); - } - - if (!empty($options)) { - $temp['adapter'] = array_shift($options); - } - - $options = $temp; - } - - if (!array_key_exists('table', $options) && !array_key_exists('schema', $options)) { - require_once 'Zend/Validate/Exception.php'; - - throw new Zend_Validate_Exception('Table or Schema option missing!'); - } - - if (!array_key_exists('field', $options)) { - require_once 'Zend/Validate/Exception.php'; - - throw new Zend_Validate_Exception('Field option missing!'); - } - - if (array_key_exists('adapter', $options)) { - $this->setAdapter($options['adapter']); - } - - if (array_key_exists('exclude', $options)) { - $this->setExclude($options['exclude']); - } - - $this->setField($options['field']); - if (array_key_exists('table', $options)) { - $this->setTable($options['table']); - } - - if (array_key_exists('schema', $options)) { - $this->setSchema($options['schema']); - } - } - - /** - * Returns the set adapter. - * - * @return Zend_Db_Adapter - */ - public function getAdapter() - { - // Check for an adapter being defined. if not, fetch the default adapter. - if ($this->_adapter === null) { - $this->_adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); - if (null === $this->_adapter) { - require_once 'Zend/Validate/Exception.php'; - - throw new Zend_Validate_Exception('No database adapter present'); - } - } - - return $this->_adapter; - } - - /** - * Sets a new database adapter. - * - * @param Zend_Db_Adapter_Abstract $adapter - * - * @return Zend_Validate_Db_Abstract - */ - public function setAdapter($adapter) - { - if (!($adapter instanceof Zend_Db_Adapter_Abstract)) { - require_once 'Zend/Validate/Exception.php'; - - throw new Zend_Validate_Exception('Adapter option must be a database adapter!'); - } - - $this->_adapter = $adapter; - - return $this; - } - - /** - * Returns the set exclude clause. - * - * @return array|string - */ - public function getExclude() - { - return $this->_exclude; - } - - /** - * Sets a new exclude clause. - * - * @param array|string $exclude - * - * @return Zend_Validate_Db_Abstract - */ - public function setExclude($exclude) - { - $this->_exclude = $exclude; - - return $this; - } - - /** - * Returns the set field. - * - * @return array|string - */ - public function getField() - { - return $this->_field; - } - - /** - * Sets a new field. - * - * @param string $field - * - * @return Zend_Validate_Db_Abstract - */ - public function setField($field) - { - $this->_field = (string) $field; - - return $this; - } - - /** - * Returns the set table. - * - * @return string - */ - public function getTable() - { - return $this->_table; - } - - /** - * Sets a new table. - * - * @param string $table - * - * @return Zend_Validate_Db_Abstract - */ - public function setTable($table) - { - $this->_table = (string) $table; - - return $this; - } - - /** - * Returns the set schema. - * - * @return string - */ - public function getSchema() - { - return $this->_schema; - } - - /** - * Sets a new schema. - * - * @param string $schema - * - * @return Zend_Validate_Db_Abstract - */ - public function setSchema($schema) - { - $this->_schema = $schema; - - return $this; - } - - /** - * Sets the select object to be used by the validator. - * - * @param Zend_Db_Select $select - * - * @return Zend_Validate_Db_Abstract - */ - public function setSelect($select) - { - if (!$select instanceof Zend_Db_Select) { - throw new Zend_Validate_Exception('Select option must be a valid ' - . 'Zend_Db_Select object'); - } - $this->_select = $select; - - return $this; - } - - /** - * Gets the select object to be used by the validator. - * If no select object was supplied to the constructor, - * then it will auto-generate one from the given table, - * schema, field, and adapter options. - * - * @return Zend_Db_Select The Select object which will be used - */ - public function getSelect() - { - if (null === $this->_select) { - $db = $this->getAdapter(); - /** - * Build select object. - */ - $select = new Zend_Db_Select($db); - $select->from($this->_table, [$this->_field], $this->_schema); - if ($db->supportsParameters('named')) { - $select->where($db->quoteIdentifier($this->_field, true) . ' = :value'); // named - } else { - $select->where($db->quoteIdentifier($this->_field, true) . ' = ?'); // positional - } - if ($this->_exclude !== null) { - if (is_array($this->_exclude)) { - $select->where( - $db->quoteIdentifier($this->_exclude['field'], true) - . ' != ?', $this->_exclude['value'] - ); - } else { - $select->where($this->_exclude); - } - } - $select->limit(1); - $this->_select = $select; - } - - return $this->_select; - } - - /** - * Run query and returns matches, or null if no matches are found. - * - * @param string $value - * - * @return array when matches are found - */ - protected function _query($value) - { - $select = $this->getSelect(); - /** - * Run query. - */ - $result = $select->getAdapter()->fetchRow( - $select, - ['value' => $value], // this should work whether db supports positional or named params - Zend_Db::FETCH_ASSOC - ); - - return $result; - } -} diff --git a/library/Zend/Validate/Db/NoRecordExists.php b/library/Zend/Validate/Db/NoRecordExists.php deleted file mode 100644 index e968676a0..000000000 --- a/library/Zend/Validate/Db/NoRecordExists.php +++ /dev/null @@ -1,48 +0,0 @@ -_setValue($value); - - $result = $this->_query($value); - if ($result) { - $valid = false; - $this->_error(self::ERROR_RECORD_FOUND); - } - - return $valid; - } -} diff --git a/library/Zend/Validate/Db/RecordExists.php b/library/Zend/Validate/Db/RecordExists.php deleted file mode 100644 index 047909c54..000000000 --- a/library/Zend/Validate/Db/RecordExists.php +++ /dev/null @@ -1,48 +0,0 @@ -_setValue($value); - - $result = $this->_query($value); - if (!$result) { - $valid = false; - $this->_error(self::ERROR_NO_RECORD_FOUND); - } - - return $valid; - } -} diff --git a/library/Zend/Validate/Digits.php b/library/Zend/Validate/Digits.php index a0c7df719..264db406e 100644 --- a/library/Zend/Validate/Digits.php +++ b/library/Zend/Validate/Digits.php @@ -1,4 +1,5 @@ validateMxSupported()) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('MX checking not available on this system'); } @@ -509,8 +498,7 @@ private function _validateMXRecords() */ private function _validateHostnamePart() { - $hostname = $this->_options['hostname']->setTranslator($this->getTranslator()) - ->isValid($this->_hostname); + $hostname = $this->_options['hostname']->isValid($this->_hostname); if (!$hostname) { $this->_error(self::INVALID_HOSTNAME); diff --git a/library/Zend/Validate/Exception.php b/library/Zend/Validate/Exception.php index c25eb13ad..4f4ec9376 100644 --- a/library/Zend/Validate/Exception.php +++ b/library/Zend/Validate/Exception.php @@ -1,4 +1,5 @@ $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -149,17 +143,13 @@ public function setMin($min) } if (!is_string($min) and !is_numeric($min)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } $min = (integer) $min; if (($this->_max !== null) && ($min > $this->_max)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("The minimum must be less than or equal to the maximum file count, but $min >" - . " {$this->_max}"); + . " {$this->_max}"); } $this->_min = $min; @@ -191,17 +181,13 @@ public function setMax($max) } if (!is_string($max) and !is_numeric($max)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } $max = (integer) $max; if (($this->_min !== null) && ($max < $this->_min)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum must be greater than or equal to the minimum file count, but ' - . "$max < {$this->_min}"); + . "$max < {$this->_min}"); } $this->_max = $max; diff --git a/library/Zend/Validate/File/Crc32.php b/library/Zend/Validate/File/Crc32.php index 4b4e409a6..b6f4ba425 100644 --- a/library/Zend/Validate/File/Crc32.php +++ b/library/Zend/Validate/File/Crc32.php @@ -1,4 +1,5 @@ $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -164,7 +158,6 @@ public function addCrc32($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/ExcludeExtension.php b/library/Zend/Validate/File/ExcludeExtension.php index 5c2691d06..79569db51 100644 --- a/library/Zend/Validate/File/ExcludeExtension.php +++ b/library/Zend/Validate/File/ExcludeExtension.php @@ -1,4 +1,5 @@ _throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/ExcludeMimeType.php b/library/Zend/Validate/File/ExcludeMimeType.php index bd3eb4cb8..0ff95cc96 100644 --- a/library/Zend/Validate/File/ExcludeMimeType.php +++ b/library/Zend/Validate/File/ExcludeMimeType.php @@ -1,4 +1,5 @@ _throw($file, self::NOT_READABLE); } diff --git a/library/Zend/Validate/File/Exists.php b/library/Zend/Validate/File/Exists.php index d5beac330..7c691c29c 100644 --- a/library/Zend/Validate/File/Exists.php +++ b/library/Zend/Validate/File/Exists.php @@ -1,4 +1,5 @@ _throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/FilesSize.php b/library/Zend/Validate/File/FilesSize.php index e3309506a..1cb6f67b6 100644 --- a/library/Zend/Validate/File/FilesSize.php +++ b/library/Zend/Validate/File/FilesSize.php @@ -1,4 +1,5 @@ $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -101,7 +95,6 @@ public function __construct($options) */ public function isValid($value, $file = null) { - require_once 'Zend/Loader.php'; if (is_string($value)) { $value = [$value]; } diff --git a/library/Zend/Validate/File/Hash.php b/library/Zend/Validate/File/Hash.php index c71717440..2b7b57e24 100644 --- a/library/Zend/Validate/File/Hash.php +++ b/library/Zend/Validate/File/Hash.php @@ -1,4 +1,5 @@ $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -114,8 +108,6 @@ public function addHash($options) if (is_string($options)) { $options = [$options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('False parameter given'); } @@ -128,8 +120,6 @@ public function addHash($options) } if (!in_array($algorithm, $known)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Unknown algorithm '{$algorithm}'"); } @@ -153,7 +143,6 @@ public function addHash($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/ImageSize.php b/library/Zend/Validate/File/ImageSize.php index b84078117..f6a403ba5 100644 --- a/library/Zend/Validate/File/ImageSize.php +++ b/library/Zend/Validate/File/ImageSize.php @@ -1,4 +1,5 @@ _maxwidth !== null) and ($options['minwidth'] > $this->_maxwidth)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The minimum image width must be less than or equal to the ' . " maximum image width, but {$options['minwidth']} > {$this->_maxwidth}"); } @@ -209,8 +201,6 @@ public function setImageMin($options) if (isset($options['maxheight'])) { if (($this->_maxheight !== null) and ($options['minheight'] > $this->_maxheight)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The minimum image height must be less than or equal to the ' . " maximum image height, but {$options['minheight']} > {$this->_maxheight}"); } @@ -238,8 +228,6 @@ public function setImageMax($options) { if (isset($options['maxwidth'])) { if (($this->_minwidth !== null) and ($options['maxwidth'] < $this->_minwidth)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum image width must be greater than or equal to the ' . "minimum image width, but {$options['maxwidth']} < {$this->_minwidth}"); } @@ -247,8 +235,6 @@ public function setImageMax($options) if (isset($options['maxheight'])) { if (($this->_minheight !== null) and ($options['maxheight'] < $this->_minheight)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum image height must be greater than or equal to the ' . "minimum image height, but {$options['maxheight']} < {$this->_minwidth}"); } @@ -309,7 +295,6 @@ public function setImageHeight($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_READABLE); } diff --git a/library/Zend/Validate/File/IsCompressed.php b/library/Zend/Validate/File/IsCompressed.php index d4b5cec80..ddfbec8e7 100644 --- a/library/Zend/Validate/File/IsCompressed.php +++ b/library/Zend/Validate/File/IsCompressed.php @@ -1,4 +1,5 @@ $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -166,7 +160,6 @@ public function addMd5($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/MimeType.php b/library/Zend/Validate/File/MimeType.php index 1c957e1fa..81a3bec9f 100644 --- a/library/Zend/Validate/File/MimeType.php +++ b/library/Zend/Validate/File/MimeType.php @@ -1,4 +1,5 @@ shouldTryCommonMagicFiles() // @see ZF-11784 ) { - require_once 'Zend/Validate/Exception.php'; foreach ($this->_magicFiles as $file) { // supressing errors which are thrown due to openbase_dir restrictions try { @@ -205,14 +198,11 @@ public function setMagicFile($file) { if (empty($file)) { $this->_magicfile = null; - } elseif (!(class_exists(\finfo::class, false))) { + } elseif (!(class_exists(finfo::class, false))) { $this->_magicfile = null; - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Magicfile can not be set. There is no finfo extension installed'); } elseif (!is_file($file) || !is_readable($file)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The given magicfile can not be read'); } else { $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; @@ -221,7 +211,6 @@ public function setMagicFile($file) restore_error_handler(); if (empty($this->_finfo)) { $this->_finfo = null; - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception( sprintf('The given magicfile ("%s") is not accepted by finfo', $file), @@ -336,8 +325,6 @@ public function addMimeType($mimetype) if (is_string($mimetype)) { $mimetype = explode(',', $mimetype); } elseif (!is_array($mimetype)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -387,7 +374,6 @@ public function isValid($value, $file = null) } // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_READABLE); } @@ -447,7 +433,7 @@ protected function _detectMimeType($file) $mimefile = $this->getMagicFile(); $type = null; - if (class_exists(\finfo::class, false)) { + if (class_exists(finfo::class, false)) { $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; if (!empty($mimefile) && empty($this->_finfo)) { diff --git a/library/Zend/Validate/File/NotExists.php b/library/Zend/Validate/File/NotExists.php index f3fda96af..1e0636372 100644 --- a/library/Zend/Validate/File/NotExists.php +++ b/library/Zend/Validate/File/NotExists.php @@ -1,4 +1,5 @@ $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -166,7 +160,6 @@ public function addSha1($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/Size.php b/library/Zend/Validate/File/Size.php index 4c437137f..a5db48ed5 100644 --- a/library/Zend/Validate/File/Size.php +++ b/library/Zend/Validate/File/Size.php @@ -1,4 +1,5 @@ $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -182,18 +176,14 @@ public function getMin($raw = false) public function setMin($min) { if (!is_string($min) and !is_numeric($min)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } $min = (integer) $this->_fromByteString($min); $max = $this->getMax(true); if (($max !== null) && ($min > $max)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("The minimum must be less than or equal to the maximum filesize, but $min >" - . " $max"); + . " $max"); } $this->_min = $min; @@ -228,18 +218,14 @@ public function getMax($raw = false) public function setMax($max) { if (!is_string($max) && !is_numeric($max)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } $max = (integer) $this->_fromByteString($max); $min = $this->getMin(true); if (($min !== null) && ($max < $min)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum must be greater than or equal to the minimum filesize, but ' - . "$max < $min"); + . "$max < $min"); } $this->_max = $max; @@ -285,7 +271,6 @@ protected function _setSize($size) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/Upload.php b/library/Zend/Validate/File/Upload.php index 34e8d9788..2b22c38da 100644 --- a/library/Zend/Validate/File/Upload.php +++ b/library/Zend/Validate/File/Upload.php @@ -1,4 +1,5 @@ _throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/Float.php b/library/Zend/Validate/Float.php index 03d059d58..4d7db17ba 100644 --- a/library/Zend/Validate/Float.php +++ b/library/Zend/Validate/Float.php @@ -1,4 +1,5 @@ _locale = Zend_Locale::findLocale($locale); return $this; diff --git a/library/Zend/Validate/GreaterThan.php b/library/Zend/Validate/GreaterThan.php index 80aa1b342..6bde61e8b 100644 --- a/library/Zend/Validate/GreaterThan.php +++ b/library/Zend/Validate/GreaterThan.php @@ -1,4 +1,5 @@ 'Hostname/Biz.php', 'BR' => [1 => '/^[\x{002d}0-9a-zà-ãçéíó-õúü]{1,63}$/iu'], 'BV' => [1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'], - 'CA' => [1 => '/^[\x{002d}0-9a-zàâæçéèêëîïôœùûüÿ\x{00E0}\x{00E2}\x{00E7}\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{00EE}\x{00EF}\x{00F4}\x{00F9}\x{00FB}\x{00FC}\x{00E6}\x{0153}\x{00FF}]{1,63}$/iu'], 'CAT' => [1 => '/^[\x{002d}0-9a-z·àç-éíïòóúü]{1,63}$/iu'], 'CH' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'], 'CL' => [1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'], 'CN' => 'Hostname/Cn.php', 'COM' => 'Hostname/Com.php', - 'DE' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťßţŧŭůűũųūŵŷźžż]{1,63}$/iu'], - 'DK' => [1 => '/^[\x{002d}0-9a-zäéöüæøå]{1,63}$/iu'], + 'DE' => [1 => '/^[\x{002d}0-9a-záàăâåäãąāæćĉčċçďđéèĕêěëėęēğĝġģĥħíìĭîïĩįīıĵķĺľļłńňñņŋóòŏôöőõøōœĸŕřŗśŝšşßťţŧúùŭûůüűũųūŵýŷÿźžżðþ]{1,63}$/iu'], + 'DK' => [1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu'], + 'EE' => [1 => '/^[\x{002d}0-9a-zäõöüšž]{1,63}$/iu'], 'ES' => [1 => '/^[\x{002d}0-9a-zàáçèéíïñòóúü·]{1,63}$/iu'], - 'EU' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu', + 'EU' => [ + 1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu', 4 => '/^[\x{002d}0-9a-zΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ]{1,63}$/iu', 5 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюя]{1,63}$/iu', - 6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ὼώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ῒΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu', ], + 6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ὼώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ῒΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu', + ], 'FI' => [1 => '/^[\x{002d}0-9a-zäåö]{1,63}$/iu'], 'GR' => [1 => '/^[\x{002d}0-9a-zΆΈΉΊΌΎ-ΡΣ-ώἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼῂῃῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲῳῴῶ-ῼ]{1,63}$/iu'], 'HK' => 'Hostname/Cn.php', + 'HR' => [1 => '/^[\x{002d}0-9a-zžćčđš]{1,63}$/iu'], 'HU' => [1 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu'], - 'IL' => [1 => '/^[\x{002d}0-9\x{05D0}-\x{05EA}]{1,63}$/iu', - 2 => '/^[\x{002d}0-9a-z]{1,63}$/i', ], - 'INFO' => [1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu', + 'IL' => [ + 1 => '/^[\x{002d}0-9\x{05D0}-\x{05EA}]{1,63}$/iu', + 2 => '/^[\x{002d}0-9a-z]{1,63}$/i', + ], + 'INFO' => [ + 1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-záæéíðóöúýþ]{1,63}$/iu', 4 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu', 5 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', 6 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu', 7 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu', - 8 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', ], + 8 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', + ], 'IO' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'], 'IS' => [1 => '/^[\x{002d}0-9a-záéýúíóþæöð]{1,63}$/iu'], 'IT' => [1 => '/^[\x{002d}0-9a-zàâäèéêëìîïòôöùûüæœçÿß-]{1,63}$/iu'], @@ -1404,15 +1686,18 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'NET' => 'Hostname/Com.php', 'NO' => [1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'], 'NU' => 'Hostname/Com.php', - 'ORG' => [1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', + 'ORG' => [ + 1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-záäåæéëíðóöøúüýþ]{1,63}$/iu', 4 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu', 5 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu', 6 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu', - 7 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', ], + 7 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', + ], 'PE' => [1 => '/^[\x{002d}0-9a-zñáéíóúü]{1,63}$/iu'], - 'PL' => [1 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', + 'PL' => [ + 1 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', 2 => '/^[\x{002d}а-ик-ш\x{0450}ѓѕјљњќџ]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-zâîăşţ]{1,63}$/iu', 4 => '/^[\x{002d}0-9а-яё\x{04C2}]{1,63}$/iu', @@ -1444,10 +1729,11 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 30 => '/^[\x{002d}0-9a-záäåæéëíðóöøúüýþ]{1,63}$/iu', 31 => '/^[\x{002d}0-9a-zàâæçèéêëîïñôùûüÿœ]{1,63}$/iu', 32 => '/^[\x{002d}0-9а-щъыьэюяёєіїґ]{1,63}$/iu', - 33 => '/^[\x{002d}0-9א-ת]{1,63}$/iu', ], + 33 => '/^[\x{002d}0-9א-ת]{1,63}$/iu', + ], 'PR' => [1 => '/^[\x{002d}0-9a-záéíóúñäëïüöâêîôûàèùæçœãõ]{1,63}$/iu'], 'PT' => [1 => '/^[\x{002d}0-9a-záàâãçéêíóôõú]{1,63}$/iu'], - 'RS' => [1 => '/^[\x{002D}\x{0030}-\x{0039}\x{0061}-\x{007A}\x{0107}\x{010D}\x{0111}\x{0161}\x{017E}]{1,63}$/iu)'], + 'RS' => [1 => '/^[\x{002d}0-9a-zßáâäçéëíîóôöúüýăąćčďđęěĺľłńňőŕřśşšţťůűźżž]{1,63}$/iu'], 'RU' => [1 => '/^[\x{002d}0-9а-яё]{1,63}$/iu'], 'SA' => [1 => '/^[\x{002d}.0-9\x{0621}-\x{063A}\x{0641}-\x{064A}\x{0660}-\x{0669}]{1,63}$/iu'], 'SE' => [1 => '/^[\x{002d}0-9a-zäåéöü]{1,63}$/iu'], @@ -1455,7 +1741,8 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'SI' => [ 1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu', - 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu', ], + 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu', + ], 'SJ' => [1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'], 'TH' => [1 => '/^[\x{002d}0-9a-z\x{0E01}-\x{0E3A}\x{0E40}-\x{0E4D}\x{0E50}-\x{0E59}]{1,63}$/iu'], 'TM' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu'], @@ -1496,10 +1783,18 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'NET' => [3 => 17, 5 => 20], 'ORG' => [6 => 17], 'TW' => [1 => 20], - 'ایران' => [1 => 30], + 'امارات' => [1 => 30], + 'الاردن' => [1 => 30], + 'السعودية' => [1 => 30], + 'تونس' => [1 => 30], + 'مصر' => [1 => 30], + 'فلسطين' => [1 => 30], + 'شبكة' => [1 => 30], '中国' => [1 => 20], - '公司' => [1 => 20], - '网络' => [1 => 20], + '中國' => [1 => 20], + '香港' => [1 => 20], + '台湾' => [1 => 20], + '台灣' => [1 => 20], ]; protected $_options = [ @@ -1703,7 +1998,7 @@ public function isValid($value) $this->_setValue($value); // Check input against IP address schema if (preg_match('/^[0-9a-f:.]*$/i', $value) - && $this->_options['ip']->setTranslator($this->getTranslator())->isValid($value)) { + && $this->_options['ip']->isValid($value)) { if (!($this->_options['allow'] & self::ALLOW_IP)) { $this->_error(self::IP_ADDRESS_NOT_ALLOWED); @@ -1739,7 +2034,7 @@ public function isValid($value) // Prevent partitial IP V4 adresses (ending '.') if ((count($domainParts) == 4) && preg_match('/^[0-9.a-e:.]*$/i', $value) - && $this->_options['ip']->setTranslator($this->getTranslator())->isValid($value)) { + && $this->_options['ip']->isValid($value)) { $this->_error(self::INVALID_LOCAL_NAME); } diff --git a/library/Zend/Validate/Hostname/Biz.php b/library/Zend/Validate/Hostname/Biz.php index fec58eb0f..35717b02e 100644 --- a/library/Zend/Validate/Hostname/Biz.php +++ b/library/Zend/Validate/Hostname/Biz.php @@ -1,4 +1,5 @@ toArray(); } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Array expected as parameter'); } else { $count = func_num_args(); diff --git a/library/Zend/Validate/Int.php b/library/Zend/Validate/Int.php index 6c979d9e8..08f383ebf 100644 --- a/library/Zend/Validate/Int.php +++ b/library/Zend/Validate/Int.php @@ -1,4 +1,5 @@ _locale = Zend_Locale::findLocale($locale); return $this; diff --git a/library/Zend/Validate/Interface.php b/library/Zend/Validate/Interface.php index ac6507213..9fe2c008e 100644 --- a/library/Zend/Validate/Interface.php +++ b/library/Zend/Validate/Interface.php @@ -1,4 +1,5 @@ _options['allowipv4'] && !$this->_options['allowipv6']) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Nothing to validate. Check your options'); } diff --git a/library/Zend/Validate/Isbn.php b/library/Zend/Validate/Isbn.php index a5a8ae6d1..902e52bad 100644 --- a/library/Zend/Validate/Isbn.php +++ b/library/Zend/Validate/Isbn.php @@ -1,4 +1,5 @@ toArray(); } if (!is_array($options)) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options provided.'); } @@ -226,11 +217,6 @@ public function setSeparator($separator) { // check separator if (!in_array($separator, ['-', ' ', ''])) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid ISBN separator.'); } @@ -260,11 +246,6 @@ public function setType($type) { // check type if (!in_array($type, [self::AUTO, self::ISBN10, self::ISBN13])) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid ISBN type'); } diff --git a/library/Zend/Validate/LessThan.php b/library/Zend/Validate/LessThan.php index 4517a2dd6..b07c669f3 100644 --- a/library/Zend/Validate/LessThan.php +++ b/library/Zend/Validate/LessThan.php @@ -1,4 +1,5 @@ self::ALL)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Unknown type'); } diff --git a/library/Zend/Validate/PostCode.php b/library/Zend/Validate/PostCode.php index 73131043a..2dbe6ae47 100644 --- a/library/Zend/Validate/PostCode.php +++ b/library/Zend/Validate/PostCode.php @@ -1,4 +1,5 @@ setLocale(Zend_Registry::get(\Zend_Locale::class)); + if (Zend_Registry::isRegistered(Zend_Locale::class)) { + $this->setLocale(Zend_Registry::get(Zend_Locale::class)); } } elseif (is_array($options)) { // Received @@ -93,8 +83,6 @@ public function __construct($options = null) $format = $this->getFormat(); if (empty($format)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('A postcode-format string has to be given for validation'); } } @@ -118,13 +106,10 @@ public function getLocale() */ public function setLocale($locale = null) { - require_once 'Zend/Locale.php'; $this->_locale = Zend_Locale::findLocale($locale); $locale = new Zend_Locale($this->_locale); $region = $locale->getRegion(); if (empty($region)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Unable to detect a region for the locale '$locale'"); } @@ -135,8 +120,6 @@ public function setLocale($locale = null) ); if (empty($format)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Unable to detect a postcode format for the region '{$locale->getRegion()}'"); } @@ -165,8 +148,6 @@ public function getFormat() public function setFormat($format) { if (empty($format) || !is_string($format)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('A postcode-format string has to be given for validation'); } diff --git a/library/Zend/Validate/Regex.php b/library/Zend/Validate/Regex.php index 425647c74..b7934599f 100644 --- a/library/Zend/Validate/Regex.php +++ b/library/Zend/Validate/Regex.php @@ -1,4 +1,5 @@ _pattern, 'Test'); if (false === $status) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Internal error while using the pattern '$this->_pattern'"); } diff --git a/library/Zend/Validate/Sitemap/Changefreq.php b/library/Zend/Validate/Sitemap/Changefreq.php index 0e33dc301..20a11eeee 100644 --- a/library/Zend/Validate/Sitemap/Changefreq.php +++ b/library/Zend/Validate/Sitemap/Changefreq.php @@ -1,4 +1,5 @@ value. * diff --git a/library/Zend/Validate/Sitemap/Lastmod.php b/library/Zend/Validate/Sitemap/Lastmod.php index b7e03515c..199104ade 100644 --- a/library/Zend/Validate/Sitemap/Lastmod.php +++ b/library/Zend/Validate/Sitemap/Lastmod.php @@ -1,4 +1,5 @@ value. * diff --git a/library/Zend/Validate/Sitemap/Loc.php b/library/Zend/Validate/Sitemap/Loc.php index 0b9816908..180ddb8b4 100644 --- a/library/Zend/Validate/Sitemap/Loc.php +++ b/library/Zend/Validate/Sitemap/Loc.php @@ -1,4 +1,5 @@ value. * diff --git a/library/Zend/Validate/Sitemap/Priority.php b/library/Zend/Validate/Sitemap/Priority.php index 4ac4abb1f..3ce09a631 100644 --- a/library/Zend/Validate/Sitemap/Priority.php +++ b/library/Zend/Validate/Sitemap/Priority.php @@ -1,4 +1,5 @@ value. * diff --git a/library/Zend/Validate/StringLength.php b/library/Zend/Validate/StringLength.php index df67dd86f..8b7df4eda 100644 --- a/library/Zend/Validate/StringLength.php +++ b/library/Zend/Validate/StringLength.php @@ -1,4 +1,5 @@ _max && $min > $this->_max) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("The minimum must be less than or equal to the maximum length, but $min >" - . " $this->_max"); + . " $this->_max"); } $this->_min = max(0, (integer) $min); @@ -165,13 +156,8 @@ public function setMax($max) if (null === $max) { $this->_max = null; } elseif ($max < $this->_min) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum must be greater than or equal to the minimum length, but ' - . "$max < $this->_min"); + . "$max < $this->_min"); } else { $this->_max = (integer) $max; } @@ -213,8 +199,6 @@ public function setEncoding($encoding = null) $result = ini_get('default_charset'); } if (!$result) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Given encoding not supported on this OS!'); } diff --git a/library/Zend/View.php b/library/Zend/View.php index 957fe5a61..e84295f9a 100644 --- a/library/Zend/View.php +++ b/library/Zend/View.php @@ -1,4 +1,5 @@ _useViewStream = (bool) ini_get('short_open_tag') ? false : true; if ($this->_useViewStream) { if (!in_array('zend.view', stream_get_wrappers())) { - require_once 'Zend/View/Stream.php'; - stream_wrapper_register('zend.view', \Zend_View_Stream::class); + stream_wrapper_register('zend.view', Zend_View_Stream::class); } } diff --git a/library/Zend/View/Abstract.php b/library/Zend/View/Abstract.php index c7bea265c..1e0c3e5f6 100644 --- a/library/Zend/View/Abstract.php +++ b/library/Zend/View/Abstract.php @@ -1,4 +1,5 @@ setView($this); @@ -342,7 +339,7 @@ public function __call($name, $args) * * @return Zend_View_Abstract */ - public function setBasePath($path, $classPrefix = \Zend_View::class) + public function setBasePath($path, $classPrefix = Zend_View::class) { $path = rtrim($path, '/'); $path = rtrim($path, '\\'); @@ -371,7 +368,7 @@ public function setBasePath($path, $classPrefix = \Zend_View::class) * * @return Zend_View_Abstract */ - public function addBasePath($path, $classPrefix = \Zend_View::class) + public function addBasePath($path, $classPrefix = Zend_View::class) { $path = rtrim($path, '/'); $path = rtrim($path, '\\'); @@ -460,7 +457,6 @@ public function setPluginLoader(Zend_Loader_PluginLoader $loader, $type) { $type = strtolower($type); if (!in_array($type, $this->_loaderTypes)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Invalid plugin loader type "%s"', $type)); $e->setView($this); @@ -483,7 +479,6 @@ public function getPluginLoader($type) { $type = strtolower($type); if (!in_array($type, $this->_loaderTypes)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Invalid plugin loader type "%s"; cannot retrieve', $type)); $e->setView($this); @@ -579,7 +574,6 @@ public function getHelperPaths() public function registerHelper($helper, $name) { if (!is_object($helper)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('View helper must be an object'); $e->setView($this); @@ -588,7 +582,6 @@ public function registerHelper($helper, $name) if (!$helper instanceof Zend_View_Interface) { if (!method_exists($helper, $name)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'View helper must implement Zend_View_Interface or have a method matching the name provided' ); @@ -824,7 +817,6 @@ public function assign($spec, $value = null) if (is_string($spec)) { // assign by name and value if ('_' == substr($spec, 0, 1)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Setting private or protected class members is not allowed'); $e->setView($this); @@ -843,14 +835,12 @@ public function assign($spec, $value = null) $this->$key = $val; } if ($error) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Setting private or protected class members is not allowed'); $e->setView($this); throw $e; } } else { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('assign() expects a string or array, received ' . gettype($spec)); $e->setView($this); @@ -992,7 +982,6 @@ public function strictVars($flag = true) protected function _script($name) { if ($this->isLfiProtectionOn() && preg_match('#\.\.[\\\/]#', $name)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Requested scripts may not include parent directory traversal ("../", "..\\" notation)'); $e->setView($this); @@ -1000,7 +989,6 @@ protected function _script($name) } if (0 == (is_countable($this->_path['script']) ? count($this->_path['script']) : 0)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('no view script directory set; unable to determine location for view script'); $e->setView($this); @@ -1013,10 +1001,9 @@ protected function _script($name) } } - require_once 'Zend/View/Exception.php'; $message = "script '$name' not found in path (" - . implode(PATH_SEPARATOR, $this->_path['script']) - . ')'; + . implode(PATH_SEPARATOR, $this->_path['script']) + . ')'; $e = new Zend_View_Exception($message); $e->setView($this); diff --git a/library/Zend/View/Exception.php b/library/Zend/View/Exception.php index e42713545..619334bf3 100644 --- a/library/Zend/View/Exception.php +++ b/library/Zend/View/Exception.php @@ -1,4 +1,5 @@ getControllerDirectory(); if (empty($modules)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Action helper depends on valid front controller instance'); $e->setView($this->view); @@ -69,7 +68,6 @@ public function __construct() $response = $front->getResponse(); if (empty($request) || empty($response)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Action view helper requires both a registered request and response object in the front controller instance'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/BaseUrl.php b/library/Zend/View/Helper/BaseUrl.php index 359040c72..80cad8ef6 100644 --- a/library/Zend/View/Helper/BaseUrl.php +++ b/library/Zend/View/Helper/BaseUrl.php @@ -1,4 +1,5 @@ _baseUrl === null) { /** @see Zend_Controller_Front */ - require_once 'Zend/Controller/Front.php'; $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); // Remove scriptname, eg. index.php from baseUrl diff --git a/library/Zend/View/Helper/Currency.php b/library/Zend/View/Helper/Currency.php index 10ce4a8d7..fa3fede86 100644 --- a/library/Zend/View/Helper/Currency.php +++ b/library/Zend/View/Helper/Currency.php @@ -1,4 +1,5 @@ $currency]; } @@ -95,7 +93,6 @@ public function currency($value = null, $currency = null) public function setCurrency($currency = null) { if (!$currency instanceof Zend_Currency) { - require_once 'Zend/Currency.php'; $currency = new Zend_Currency($currency); } $this->_currency = $currency; diff --git a/library/Zend/View/Helper/Cycle.php b/library/Zend/View/Helper/Cycle.php index 9afe34051..4bb4fa2ee 100644 --- a/library/Zend/View/Helper/Cycle.php +++ b/library/Zend/View/Helper/Cycle.php @@ -1,4 +1,5 @@ _regKey)) { $this->_registry = new ArrayObject([ 'doctypes' => [ - self::XHTML11 => '', - self::XHTML1_STRICT => '', - self::XHTML1_TRANSITIONAL => '', - self::XHTML1_FRAMESET => '', - self::XHTML1_RDFA => '', - self::XHTML1_RDFA11 => '', - self::XHTML_BASIC1 => '', - self::XHTML5 => '', - self::HTML4_STRICT => '', - self::HTML4_LOOSE => '', - self::HTML4_FRAMESET => '', self::HTML5 => '', ], ]); @@ -105,7 +79,7 @@ public function __construct() /** * Set or retrieve doctype. * - * @param string $doctype + * @param string $doctype * * @return Zend_View_Helper_Doctype */ @@ -113,37 +87,9 @@ public function doctype($doctype = null) { if (null !== $doctype) { switch ($doctype) { - case self::XHTML11: - case self::XHTML1_STRICT: - case self::XHTML1_TRANSITIONAL: - case self::XHTML1_FRAMESET: - case self::XHTML_BASIC1: - case self::XHTML1_RDFA: - case self::XHTML1_RDFA11: - case self::XHTML5: - case self::HTML4_STRICT: - case self::HTML4_LOOSE: - case self::HTML4_FRAMESET: case self::HTML5: $this->setDoctype($doctype); - break; - default: - if (substr($doctype, 0, 9) != 'setView($this->view); - - throw $e; - } - if (stristr($doctype, 'xhtml')) { - $type = self::CUSTOM_XHTML; - } else { - $type = self::CUSTOM; - } - $this->setDoctype($type); - $this->_registry['doctypes'][$type] = $doctype; - break; } } @@ -154,7 +100,7 @@ public function doctype($doctype = null) /** * Set doctype. * - * @param string $doctype + * @param string $doctype * * @return Zend_View_Helper_Doctype */ @@ -202,14 +148,7 @@ public function isXhtml() */ public function isStrict() { - switch ($this->getDoctype()) { - case self::XHTML1_STRICT: - case self::XHTML11: - case self::HTML4_STRICT: - return true; - default: - return false; - } + return false; } /** diff --git a/library/Zend/View/Helper/Fieldset.php b/library/Zend/View/Helper/Fieldset.php index 581e2a609..a51e153db 100644 --- a/library/Zend/View/Helper/Fieldset.php +++ b/library/Zend/View/Helper/Fieldset.php @@ -1,4 +1,5 @@ _translator; - } - - /** - * Set translator. - * - * @param null|Zend_Translate|Zend_Translate_Adapter $translator - * - * @return Zend_View_Helper_FormElement - */ - public function setTranslator($translator = null) - { - if (null === $translator) { - $this->_translator = null; - } elseif ($translator instanceof Zend_Translate_Adapter) { - $this->_translator = $translator; - } elseif ($translator instanceof Zend_Translate) { - $this->_translator = $translator->getAdapter(); - } else { - require_once 'Zend/View/Exception.php'; - $e = new Zend_View_Exception('Invalid translator specified'); - $e->setView($this->view); - - throw $e; - } - - return $this; - } - /** * Converts parameter arguments to an element info array. * diff --git a/library/Zend/View/Helper/FormErrors.php b/library/Zend/View/Helper/FormErrors.php index 00e47bf07..abb695c6e 100644 --- a/library/Zend/View/Helper/FormErrors.php +++ b/library/Zend/View/Helper/FormErrors.php @@ -1,4 +1,5 @@ getTranslator(); foreach ((array) $options as $opt_value => $opt_label) { if (is_array($opt_label)) { $opt_disable = ''; if (is_array($disable) && in_array($opt_value, $disable)) { $opt_disable = ' disabled="disabled"'; } - if (null !== $translator) { - $opt_value = $translator->translate($opt_value); - } $opt_id = ' id="' . $this->view->escape($id) . '-optgroup-' . $this->view->escape($opt_value) . '"'; $list[] = '_getGravatarUrl() . '/' - . md5(strtolower(trim($this->getEmail()))) + . md5(strtolower(trim($this->getEmail() ?? ''))) . '?s=' . $this->getImgSize() . '&d=' diff --git a/library/Zend/View/Helper/HeadLink.php b/library/Zend/View/Helper/HeadLink.php index 2409d3087..e5265dd2f 100644 --- a/library/Zend/View/Helper/HeadLink.php +++ b/library/Zend/View/Helper/HeadLink.php @@ -1,4 +1,5 @@ $argc) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('%s requires at least one argument', $method)); $e->setView($this->view); @@ -219,7 +218,6 @@ protected function _isValid($value) public function append($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('append() expects a data token; please use one of the custom append*() methods'); $e->setView($this->view); @@ -238,7 +236,6 @@ public function append($value) public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('offsetSet() expects a data token; please use one of the custom offsetSet*() methods'); $e->setView($this->view); @@ -258,7 +255,6 @@ public function offsetSet($index, $value): void public function prepend($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('prepend() expects a data token; please use one of the custom prepend*() methods'); $e->setView($this->view); @@ -278,7 +274,6 @@ public function prepend($value) public function set($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('set() expects a data token; please use one of the custom set*() methods'); $e->setView($this->view); @@ -437,7 +432,6 @@ protected function _isDuplicateStylesheet($uri) public function createDataAlternate(array $args) { if (3 > count($args)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Alternate tags require 3 arguments; %s provided', count($args))); $e->setView($this->view); diff --git a/library/Zend/View/Helper/HeadMeta.php b/library/Zend/View/Helper/HeadMeta.php index c12eaaecb..0e05de289 100644 --- a/library/Zend/View/Helper/HeadMeta.php +++ b/library/Zend/View/Helper/HeadMeta.php @@ -1,4 +1,5 @@ setView($this->view); @@ -161,7 +160,6 @@ public function __call($method, $args) } if (2 > $argc) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Too few arguments provided; requires key value, and content'); $e->setView($this->view); @@ -246,7 +244,6 @@ protected function _isValid($item) public function append($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to append; please use appendMeta()'); $e->setView($this->view); @@ -265,7 +262,6 @@ public function append($value) public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to offsetSet; please use offsetSetName() or offsetSetHttpEquiv()'); $e->setView($this->view); @@ -283,7 +279,6 @@ public function offsetSet($index, $value): void public function offsetUnset($index): void { if (!in_array($index, $this->getContainer()->getKeys())) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid index passed to offsetUnset()'); $e->setView($this->view); @@ -301,7 +296,6 @@ public function offsetUnset($index): void public function prepend($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to prepend; please use prependMeta()'); $e->setView($this->view); @@ -319,7 +313,6 @@ public function prepend($value) public function set($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to set; please use setMeta()'); $e->setView($this->view); @@ -344,7 +337,6 @@ public function set($value) public function itemToString(stdClass $item) { if (!in_array($item->type, $this->_typeKeys)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Invalid type "%s" provided for meta', $item->type)); $e->setView($this->view); @@ -356,8 +348,6 @@ public function itemToString(stdClass $item) foreach ($item->modifiers as $key => $value) { if (!is_null($this->view) && $this->view->doctype()->isHtml5() && $key == 'scheme') { - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception('Invalid modifier ' . '"scheme" provided; not supported by HTML5'); } diff --git a/library/Zend/View/Helper/HeadScript.php b/library/Zend/View/Helper/HeadScript.php index 0385b975f..3cbb2f7d8 100644 --- a/library/Zend/View/Helper/HeadScript.php +++ b/library/Zend/View/Helper/HeadScript.php @@ -1,4 +1,5 @@ _captureLock) { - require_once 'Zend/View/Helper/Placeholder/Container/Exception.php'; $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest headScript captures'); $e->setView($this->view); @@ -220,7 +219,6 @@ public function __call($method, $args) $index = null; if (preg_match('/^(?Pset|(ap|pre)pend|offsetSet)(?PFile|Script)$/', $method, $matches)) { if (1 > count($args)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Method "%s" requires at least one argument', $method)); $e->setView($this->view); @@ -235,7 +233,6 @@ public function __call($method, $args) if ('offsetSet' == $action) { $index = array_shift($args); if (1 > count($args)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Method "%s" requires at least two arguments, an index and source', $method)); $e->setView($this->view); @@ -329,7 +326,6 @@ protected function _isValid($value) public function append($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid argument passed to append(); please use one of the helper methods, appendScript() or appendFile()'); $e->setView($this->view); @@ -347,7 +343,6 @@ public function append($value) public function prepend($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid argument passed to prepend(); please use one of the helper methods, prependScript() or prependFile()'); $e->setView($this->view); @@ -365,7 +360,6 @@ public function prepend($value) public function set($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid argument passed to set(); please use one of the helper methods, setScript() or setFile()'); $e->setView($this->view); @@ -384,7 +378,6 @@ public function set($value) public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid argument passed to offsetSet(); please use one of the helper methods, offsetSetScript() or offsetSetFile()'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/HeadStyle.php b/library/Zend/View/Helper/HeadStyle.php index 173cb40f0..d6cb2d5d1 100644 --- a/library/Zend/View/Helper/HeadStyle.php +++ b/library/Zend/View/Helper/HeadStyle.php @@ -1,4 +1,5 @@ $argc) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Method "%s" requires minimally content for the stylesheet', $method)); $e->setView($this->view); @@ -206,7 +205,6 @@ protected function _isValid($value) public function append($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to append; please use appendStyle()'); $e->setView($this->view); @@ -225,7 +223,6 @@ public function append($value) public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to offsetSet; please use offsetSetStyle()'); $e->setView($this->view); @@ -243,7 +240,6 @@ public function offsetSet($index, $value): void public function prepend($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to prepend; please use prependStyle()'); $e->setView($this->view); @@ -261,7 +257,6 @@ public function prepend($value) public function set($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to set; please use setStyle()'); $e->setView($this->view); @@ -280,7 +275,6 @@ public function set($value) public function captureStart($type = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $attrs = null) { if ($this->_captureLock) { - require_once 'Zend/View/Helper/Placeholder/Container/Exception.php'; $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest headStyle captures'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/HeadTitle.php b/library/Zend/View/Helper/HeadTitle.php index 35d8cc098..ded758a88 100644 --- a/library/Zend/View/Helper/HeadTitle.php +++ b/library/Zend/View/Helper/HeadTitle.php @@ -1,4 +1,5 @@ _defaultAttachOrder; } - /** - * Sets a translation Adapter for translation. - * - * @param Zend_Translate|Zend_Translate_Adapter $translate - * - * @return Zend_View_Helper_HeadTitle - */ - public function setTranslator($translate) - { - if ($translate instanceof Zend_Translate_Adapter) { - $this->_translator = $translate; - } elseif ($translate instanceof Zend_Translate) { - $this->_translator = $translate->getAdapter(); - } else { - require_once 'Zend/View/Exception.php'; - $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); - $e->setView($this->view); - - throw $e; - } - - return $this; - } - - /** - * Retrieve translation object. - * - * If none is currently registered, attempts to pull it from the registry - * using the key 'Zend_Translate'. - * - * @return null|Zend_Translate_Adapter - */ - public function getTranslator() - { - if (null === $this->_translator) { - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered(\Zend_Translate::class)) { - $this->setTranslator(Zend_Registry::get(\Zend_Translate::class)); - } - } - - return $this->_translator; - } - - /** - * Enables translation. - * - * @return Zend_View_Helper_HeadTitle - */ - public function enableTranslation() - { - $this->_translate = true; - - return $this; - } - - /** - * Disables translation. - * - * @return Zend_View_Helper_HeadTitle - */ - public function disableTranslation() - { - $this->_translate = false; - - return $this; - } - /** * Turn helper into string. * @@ -201,14 +117,8 @@ public function toString($indent = null, $locale = null) $items = []; - if ($this->_translate && $translator = $this->getTranslator()) { - foreach ($this as $item) { - $items[] = $translator->translate($item, $locale); - } - } else { - foreach ($this as $item) { - $items[] = $item; - } + foreach ($this as $item) { + $items[] = $item; } $separator = $this->getSeparator(); diff --git a/library/Zend/View/Helper/HtmlElement.php b/library/Zend/View/Helper/HtmlElement.php index 82e00f019..a9f3d774a 100644 --- a/library/Zend/View/Helper/HtmlElement.php +++ b/library/Zend/View/Helper/HtmlElement.php @@ -1,4 +1,5 @@ setView($this->view); diff --git a/library/Zend/View/Helper/HtmlObject.php b/library/Zend/View/Helper/HtmlObject.php index 279761c76..9b6304a8e 100644 --- a/library/Zend/View/Helper/HtmlObject.php +++ b/library/Zend/View/Helper/HtmlObject.php @@ -1,4 +1,5 @@ disableLayout(); diff --git a/library/Zend/View/Helper/Layout.php b/library/Zend/View/Helper/Layout.php index f7e415d8a..cd5be0874 100644 --- a/library/Zend/View/Helper/Layout.php +++ b/library/Zend/View/Helper/Layout.php @@ -1,4 +1,5 @@ _layout) { - require_once 'Zend/Layout.php'; $this->_layout = Zend_Layout::getMvcInstance(); if (null === $this->_layout) { // Implicitly creates layout object diff --git a/library/Zend/View/Helper/Navigation.php b/library/Zend/View/Helper/Navigation.php index 76890bcd3..fdb200401 100644 --- a/library/Zend/View/Helper/Navigation.php +++ b/library/Zend/View/Helper/Navigation.php @@ -1,4 +1,5 @@ setView($this->view); @@ -193,7 +181,7 @@ public function findHelper($proxy, $strict = true) } /** - * Injects container, ACL, and translator to the given $helper if this + * Injects container and ACL to the given $helper if this * helper is configured to do so. * * @param Zend_View_Helper_Navigation_Helper $helper helper instance @@ -212,10 +200,6 @@ protected function _inject(Zend_View_Helper_Navigation_Helper $helper) $helper->setRole($this->getRole()); } } - - if ($this->getInjectTranslator() && !$helper->hasTranslator()) { - $helper->setTranslator($this->getTranslator()); - } } // Accessors: @@ -296,32 +280,6 @@ public function getInjectAcl() return $this->_injectAcl; } - /** - * Sets whether translator should be injected when proxying. - * - * @param bool $injectTranslator [optional] whether translator should - * be injected when proxying. Default - * is true. - * - * @return Zend_View_Helper_Navigation fluent interface, returns self - */ - public function setInjectTranslator($injectTranslator = true) - { - $this->_injectTranslator = (bool) $injectTranslator; - - return $this; - } - - /** - * Returns whether translator should be injected when proxying. - * - * @return bool whether translator should be injected when proxying - */ - public function getInjectTranslator() - { - return $this->_injectTranslator; - } - // Zend_View_Helper_Navigation_Helper: /** diff --git a/library/Zend/View/Helper/Navigation/Breadcrumbs.php b/library/Zend/View/Helper/Navigation/Breadcrumbs.php index 66cfc753b..db6215508 100644 --- a/library/Zend/View/Helper/Navigation/Breadcrumbs.php +++ b/library/Zend/View/Helper/Navigation/Breadcrumbs.php @@ -1,4 +1,5 @@ htmlify($active); } else { $html = $active->getLabel(); - if ($this->getUseTranslator() && $t = $this->getTranslator()) { - $html = $t->translate($html); - } $html = $this->view->escape($html); } @@ -259,7 +252,6 @@ public function renderPartial(?Zend_Navigation_Container $container = null, } if (empty($partial)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'Unable to render menu: No partial view script provided' ); @@ -292,7 +284,6 @@ public function renderPartial(?Zend_Navigation_Container $container = null, if (is_array($partial)) { if (count($partial) != 2) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'Unable to render menu: A view partial supplied as ' . 'an array must contain two values: partial view ' diff --git a/library/Zend/View/Helper/Navigation/Helper.php b/library/Zend/View/Helper/Navigation/Helper.php index a1d4c82c8..6478c25a8 100644 --- a/library/Zend/View/Helper/Navigation/Helper.php +++ b/library/Zend/View/Helper/Navigation/Helper.php @@ -1,4 +1,5 @@ _container) { // try to fetch from registry first - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered(\Zend_Navigation::class)) { - $nav = Zend_Registry::get(\Zend_Navigation::class); + if (Zend_Registry::isRegistered(Zend_Navigation::class)) { + $nav = Zend_Registry::get(Zend_Navigation::class); if ($nav instanceof Zend_Navigation_Container) { return $this->_container = $nav; } } // nothing found in registry, create new container - require_once 'Zend/Navigation.php'; $this->_container = new Zend_Navigation(); } @@ -390,54 +365,6 @@ public function skipPrefixForId($flag = true) return $this; } - /** - * Sets translator to use in helper. - * - * Implements {@link Zend_View_Helper_Navigation_Helper::setTranslator()}. - * - * @param mixed $translator [optional] translator. - * Expects an object of - * type - * {@link Zend_Translate_Adapter} - * or {@link Zend_Translate}, - * or null. Default is - * null, which sets no - * translator. - * - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setTranslator($translator = null) - { - if (null == $translator - || $translator instanceof Zend_Translate_Adapter) { - $this->_translator = $translator; - } elseif ($translator instanceof Zend_Translate) { - $this->_translator = $translator->getAdapter(); - } - - return $this; - } - - /** - * Returns translator used in helper. - * - * Implements {@link Zend_View_Helper_Navigation_Helper::getTranslator()}. - * - * @return null|Zend_Translate_Adapter translator or null - */ - public function getTranslator() - { - if (null === $this->_translator) { - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered(\Zend_Translate::class)) { - $this->setTranslator(Zend_Registry::get(\Zend_Translate::class)); - } - } - - return $this->_translator; - } - /** * Sets ACL to use when iterating pages. * @@ -495,7 +422,6 @@ public function setRole($role = null) || $role instanceof Zend_Acl_Role_Interface) { $this->_role = $role; } else { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( '$role must be a string, null, or an instance of ' . 'Zend_Acl_Role_Interface; %s given', @@ -582,37 +508,6 @@ public function setRenderInvisible($renderInvisible = true) return $this; } - /** - * Sets whether translator should be used. - * - * Implements {@link Zend_View_Helper_Navigation_Helper::setUseTranslator()}. - * - * @param bool $useTranslator [optional] whether - * translator should be - * used. Default is true. - * - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setUseTranslator($useTranslator = true) - { - $this->_useTranslator = (bool) $useTranslator; - - return $this; - } - - /** - * Returns whether translator should be used. - * - * Implements {@link Zend_View_Helper_Navigation_Helper::getUseTranslator()}. - * - * @return bool whether translator should be used - */ - public function getUseTranslator() - { - return $this->_useTranslator; - } - // Magic overloads: /** @@ -767,18 +662,6 @@ public function hasRole() return null !== $this->_role; } - /** - * Checks if the helper has a translator. - * - * Implements {@link Zend_View_Helper_Navigation_Helper::hasTranslator()}. - * - * @return bool whether the helper has a translator or not - */ - public function hasTranslator() - { - return null !== $this->_translator; - } - /** * Returns an HTML string containing an 'a' element for the given page. * @@ -788,19 +671,10 @@ public function hasTranslator() */ public function htmlify(Zend_Navigation_Page $page) { - // get label and title for translating + // get label and title $label = $page->getLabel(); $title = $page->getTitle(); - if ($this->getUseTranslator() && $t = $this->getTranslator()) { - if (is_string($label) && !empty($label)) { - $label = $t->translate($label); - } - if (is_string($title) && !empty($title)) { - $title = $t->translate($title); - } - } - // get attribs for anchor element $attribs = array_merge( [ @@ -989,8 +863,6 @@ public static function setDefaultRole($role = null) || $role instanceof Zend_Acl_Role_Interface) { self::$_defaultRole = $role; } else { - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception( '$role must be null|string|Zend_Acl_Role_Interface' ); diff --git a/library/Zend/View/Helper/Navigation/Links.php b/library/Zend/View/Helper/Navigation/Links.php index 1eda84b46..2d3d5fdec 100644 --- a/library/Zend/View/Helper/Navigation/Links.php +++ b/library/Zend/View/Helper/Navigation/Links.php @@ -1,4 +1,5 @@ elements. * @@ -268,7 +264,6 @@ public function findAllRelations(Zend_Navigation_Page $page, public function findRelation(Zend_Navigation_Page $page, $rel, $type) { if (!in_array($rel, ['rel', 'rev'])) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( 'Invalid argument: $rel must be "rel" or "rev"; "%s" given', $rel)); @@ -729,7 +724,6 @@ protected function _convertToPages($mixed, $recursive = true) public function renderLink(Zend_Navigation_Page $page, $attrib, $relation) { if (!in_array($attrib, ['rel', 'rev'])) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( 'Invalid relation attribute "%s", must be "rel" or "rev"', $attrib)); diff --git a/library/Zend/View/Helper/Navigation/Menu.php b/library/Zend/View/Helper/Navigation/Menu.php index 973b7978d..47e94605e 100644 --- a/library/Zend/View/Helper/Navigation/Menu.php +++ b/library/Zend/View/Helper/Navigation/Menu.php @@ -1,4 +1,5 @@ getLabel(); $title = $page->getTitle(); - // translate label and title? - if ($this->getUseTranslator() && $t = $this->getTranslator()) { - if (is_string($label) && !empty($label)) { - $label = $t->translate($label); - } - if (is_string($title) && !empty($title)) { - $title = $t->translate($title); - } - } - // get attribs for element $attribs = [ 'id' => $page->getId(), @@ -1051,7 +1037,6 @@ public function renderPartial(?Zend_Navigation_Container $container = null, } if (empty($partial)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'Unable to render menu: No partial view script provided' ); @@ -1066,7 +1051,6 @@ public function renderPartial(?Zend_Navigation_Container $container = null, if (is_array($partial)) { if (count($partial) != 2) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'Unable to render menu: A view partial supplied as ' . 'an array must contain two values: partial view ' diff --git a/library/Zend/View/Helper/Navigation/Sitemap.php b/library/Zend/View/Helper/Navigation/Sitemap.php index 7cf2eb66d..3a8cf3913 100644 --- a/library/Zend/View/Helper/Navigation/Sitemap.php +++ b/library/Zend/View/Helper/Navigation/Sitemap.php @@ -1,4 +1,5 @@ setFragment(''); $uri->setPath(''); @@ -195,7 +190,6 @@ public function setServerUrl($serverUrl) if ($uri->valid()) { $this->_serverUrl = $uri->getUri(); } else { - require_once 'Zend/Uri/Exception.php'; $e = new Zend_Uri_Exception(sprintf( 'Invalid server URL: "%s"', $serverUrl)); @@ -295,11 +289,6 @@ public function getDomSitemap(?Zend_Navigation_Container $container = null) // check if we should validate using our own validators if ($this->getUseSitemapValidators()) { - require_once 'Zend/Validate/Sitemap/Changefreq.php'; - require_once 'Zend/Validate/Sitemap/Lastmod.php'; - require_once 'Zend/Validate/Sitemap/Loc.php'; - require_once 'Zend/Validate/Sitemap/Priority.php'; - // create validators $locValidator = new Zend_Validate_Sitemap_Loc(); $lastmodValidator = new Zend_Validate_Sitemap_Lastmod(); @@ -347,7 +336,6 @@ public function getDomSitemap(?Zend_Navigation_Container $container = null) if ($this->getUseSitemapValidators() && !$locValidator->isValid($url)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( 'Encountered an invalid URL for Sitemap XML: "%s"', $url)); @@ -406,7 +394,6 @@ public function getDomSitemap(?Zend_Navigation_Container $container = null) // validate using schema if specified if ($this->getUseSchemaValidation()) { if (!@$dom->schemaValidate(self::SITEMAP_XSD)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( 'Sitemap is invalid according to XML Schema at "%s"', self::SITEMAP_XSD)); diff --git a/library/Zend/View/Helper/PaginationControl.php b/library/Zend/View/Helper/PaginationControl.php index 876dd1507..1c00e8bfa 100644 --- a/library/Zend/View/Helper/PaginationControl.php +++ b/library/Zend/View/Helper/PaginationControl.php @@ -1,4 +1,5 @@ setView($this->view); @@ -106,7 +105,6 @@ public function paginationControl(?Zend_Paginator $paginator = null, $scrollingS /** * @see Zend_View_Exception */ - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('No view partial provided and no default set'); $e->setView($this->view); @@ -127,7 +125,6 @@ public function paginationControl(?Zend_Paginator $paginator = null, $scrollingS /** * @see Zend_View_Exception */ - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('A view partial supplied as an array must contain two values: the filename and its module'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Partial.php b/library/Zend/View/Helper/Partial.php index 4893be3cd..c54df54e1 100644 --- a/library/Zend/View/Helper/Partial.php +++ b/library/Zend/View/Helper/Partial.php @@ -1,4 +1,5 @@ getControllerDirectory($module); if (null === $moduleDir) { - require_once 'Zend/View/Helper/Partial/Exception.php'; $e = new Zend_View_Helper_Partial_Exception('Cannot render partial; module does not exist'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Partial/Exception.php b/library/Zend/View/Helper/Partial/Exception.php index 33ec29c85..3126c1a9e 100644 --- a/library/Zend/View/Helper/Partial/Exception.php +++ b/library/Zend/View/Helper/Partial/Exception.php @@ -1,4 +1,5 @@ setView($this->view); diff --git a/library/Zend/View/Helper/Placeholder.php b/library/Zend/View/Helper/Placeholder.php index 1527b6a21..2651e2230 100644 --- a/library/Zend/View/Helper/Placeholder.php +++ b/library/Zend/View/Helper/Placeholder.php @@ -1,4 +1,5 @@ _captureLock) { - require_once 'Zend/View/Helper/Placeholder/Container/Exception.php'; $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest placeholder captures for the same placeholder'); - $e->setView($this->view); throw $e; } diff --git a/library/Zend/View/Helper/Placeholder/Container/Exception.php b/library/Zend/View/Helper/Placeholder/Container/Exception.php index 10c423171..539a1c182 100644 --- a/library/Zend/View/Helper/Placeholder/Container/Exception.php +++ b/library/Zend/View/Helper/Placeholder/Container/Exception.php @@ -1,4 +1,5 @@ setView($this->view); diff --git a/library/Zend/View/Helper/Placeholder/Registry.php b/library/Zend/View/Helper/Placeholder/Registry.php index 139438a9c..c732007e4 100644 --- a/library/Zend/View/Helper/Placeholder/Registry.php +++ b/library/Zend/View/Helper/Placeholder/Registry.php @@ -1,4 +1,5 @@ isSubclassOf(new ReflectionClass(\Zend_View_Helper_Placeholder_Container_Abstract::class))) { - require_once 'Zend/View/Helper/Placeholder/Registry/Exception.php'; + if (!$reflection->isSubclassOf(new ReflectionClass(Zend_View_Helper_Placeholder_Container_Abstract::class))) { $e = new Zend_View_Helper_Placeholder_Registry_Exception('Invalid Container class specified'); - $e->setView($this->view); throw $e; } diff --git a/library/Zend/View/Helper/Placeholder/Registry/Exception.php b/library/Zend/View/Helper/Placeholder/Registry/Exception.php index 25251b0a1..7f88f76b4 100644 --- a/library/Zend/View/Helper/Placeholder/Registry/Exception.php +++ b/library/Zend/View/Helper/Placeholder/Registry/Exception.php @@ -1,4 +1,5 @@ setTranslator($translate); - } - } - - /** - * Translate a message - * You can give multiple params or an array of params. - * If you want to output another locale just set it as last single parameter - * Example 1: translate('%1\$s + %2\$s', $value1, $value2, $locale); - * Example 2: translate('%1\$s + %2\$s', array($value1, $value2), $locale);. - * - * @param string $messageid Id of the message to be translated - * - * @return string|Zend_View_Helper_Translate Translated message - */ - public function translate($messageid = null) - { - if ($messageid === null) { - return $this; - } - - $translate = $this->getTranslator(); - $options = func_get_args(); - - array_shift($options); - $count = count($options); - $locale = null; - if ($count > 0) { - if (Zend_Locale::isLocale($options[($count - 1)], null, false) !== false) { - $locale = array_pop($options); - } - } - - if ((count($options) === 1) and (is_array($options[0]) === true)) { - $options = $options[0]; - } - - if ($translate !== null) { - $messageid = $translate->translate($messageid, $locale); - } - - if (count($options) === 0) { - return $messageid; - } - - return vsprintf($messageid, $options); - } - - /** - * Sets a translation Adapter for translation. - * - * @param Zend_Translate|Zend_Translate_Adapter $translate Instance of Zend_Translate - * - * @return Zend_View_Helper_Translate - */ - public function setTranslator($translate) - { - if ($translate instanceof Zend_Translate_Adapter) { - $this->_translator = $translate; - } elseif ($translate instanceof Zend_Translate) { - $this->_translator = $translate->getAdapter(); - } else { - require_once 'Zend/View/Exception.php'; - $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); - $e->setView($this->view); - - throw $e; - } - - return $this; - } - - /** - * Retrieve translation object. - * - * @return null|Zend_Translate_Adapter - */ - public function getTranslator() - { - if ($this->_translator === null) { - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered(\Zend_Translate::class)) { - $this->setTranslator(Zend_Registry::get(\Zend_Translate::class)); - } - } - - return $this->_translator; - } - - /** - * Set's an new locale for all further translations. - * - * @param string|Zend_Locale $locale New locale to set - * - * @return Zend_View_Helper_Translate - */ - public function setLocale($locale = null) - { - $translate = $this->getTranslator(); - if ($translate === null) { - require_once 'Zend/View/Exception.php'; - $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); - $e->setView($this->view); - - throw $e; - } - - $translate->setLocale($locale); - - return $this; - } - - /** - * Returns the set locale for translations. - * - * @return string|Zend_Locale - */ - public function getLocale() - { - $translate = $this->getTranslator(); - if ($translate === null) { - require_once 'Zend/View/Exception.php'; - $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); - $e->setView($this->view); - - throw $e; - } - - return $translate->getLocale(); - } -} diff --git a/library/Zend/View/Helper/Url.php b/library/Zend/View/Helper/Url.php index c595ba77e..b3f797c97 100644 --- a/library/Zend/View/Helper/Url.php +++ b/library/Zend/View/Helper/Url.php @@ -1,4 +1,5 @@ setUserAgent($userAgent); - } - - return $this->getUserAgent(); - } - - /** - * Set UserAgent instance. - * - * @return Zend_View_Helper_UserAgent - */ - public function setUserAgent(Zend_Http_UserAgent $userAgent) - { - $this->_userAgent = $userAgent; - - return $this; - } - - /** - * Retrieve UserAgent instance. - * - * If none set, instantiates one using no configuration - * - * @return Zend_Http_UserAgent - */ - public function getUserAgent() - { - if (null === $this->_userAgent) { - require_once 'Zend/Http/UserAgent.php'; - $this->setUserAgent(new Zend_Http_UserAgent()); - } - - return $this->_userAgent; - } -} diff --git a/library/Zend/View/Interface.php b/library/Zend/View/Interface.php index 9962f4f83..dfb9438ec 100644 --- a/library/Zend/View/Interface.php +++ b/library/Zend/View/Interface.php @@ -1,4 +1,5 @@ loadXml($xml, LIBXML_NONET); restore_error_handler(); diff --git a/library/ZendX/Exception.php b/library/ZendX/Exception.php index 04cf4dd37..f102caf85 100644 --- a/library/ZendX/Exception.php +++ b/library/ZendX/Exception.php @@ -1,4 +1,5 @@ true]); diff --git a/library/ZendX/JQuery/Exception.php b/library/ZendX/JQuery/Exception.php index 30e673df6..7f5513365 100644 --- a/library/ZendX/JQuery/Exception.php +++ b/library/ZendX/JQuery/Exception.php @@ -1,4 +1,5 @@ _helper) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('No view helper specified fo DijitContainer decorator'); } diff --git a/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php b/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php index b9bd0ff4c..728930139 100644 --- a/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php +++ b/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php @@ -1,4 +1,5 @@ getElement(); $view = $element->getView(); if (null === $view) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('UiWidgetElement decorator cannot render without a registered view object'); } diff --git a/library/ZendX/JQuery/Form/Decorator/UiWidgetElementMarker.php b/library/ZendX/JQuery/Form/Decorator/UiWidgetElementMarker.php index 1f4ef6892..42d5c0441 100644 --- a/library/ZendX/JQuery/Form/Decorator/UiWidgetElementMarker.php +++ b/library/ZendX/JQuery/Form/Decorator/UiWidgetElementMarker.php @@ -1,4 +1,5 @@ _helper) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('No view helper specified fo UiWidgetContainer decorator'); } @@ -112,8 +110,6 @@ public function getJQueryParams() // Ensure we have a title param if (!array_key_exists('title', $this->_jQueryParams)) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception("UiWidgetPane Decorators have to have a jQueryParam 'title' to render. This title can been set via setJQueryParam('title') on the parent element."); } @@ -138,17 +134,9 @@ public function render($content) $jQueryParams = $this->getJQueryParams(); $attribs = array_merge($this->getAttribs(), $this->getOptions()); - if (isset($jQueryParams['title']) && !empty($jQueryParams['title'])) { - if (null !== ($translator = $element->getTranslator())) { - $jQueryParams['title'] = $translator->translate($jQueryParams['title']); - } - } - if (isset($jQueryParams['containerId'])) { $id = $jQueryParams['containerId'] . '-container'; } else { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception("UiWidgetPane Decorators have to have a jQueryParam 'containerId', to point at their parent container. This containerId has been set via setAttrib('id') on the parent element."); } diff --git a/library/ZendX/JQuery/Form/Element/AutoComplete.php b/library/ZendX/JQuery/Form/Element/AutoComplete.php index 3b2ba0250..b5eac7c20 100644 --- a/library/ZendX/JQuery/Form/Element/AutoComplete.php +++ b/library/ZendX/JQuery/Form/Element/AutoComplete.php @@ -1,4 +1,5 @@ _prepareAttributes($id, $value, $attribs); - if (!isset($params['dateFormat']) && Zend_Registry::isRegistered(\Zend_Locale::class)) { + if (!isset($params['dateFormat']) && Zend_Registry::isRegistered(Zend_Locale::class)) { $params['dateFormat'] = self::resolveZendLocaleToDatePickerFormat(); } - // TODO: Allow translation of DatePicker Text Values to get this action from client to server $params = ZendX_JQuery::encodeJson($params); $js = sprintf('%s("#%s").datepicker(%s);', @@ -85,16 +75,13 @@ public function datePicker($id, $value = null, array $params = [], array $attrib public static function resolveZendLocaleToDatePickerFormat($format = null) { if ($format == null) { - $locale = Zend_Registry::get(\Zend_Locale::class); + $locale = Zend_Registry::get(Zend_Locale::class); if (!($locale instanceof Zend_Locale)) { - require_once 'ZendX/JQuery/Exception.php'; - throw new ZendX_JQuery_Exception('Cannot resolve Zend Locale format by default, no application wide locale is set.'); } /** * @see Zend_Locale_Format */ - require_once 'Zend/Locale/Format.php'; $format = Zend_Locale_Format::getDateFormat($locale); } diff --git a/library/ZendX/JQuery/View/Helper/DialogContainer.php b/library/ZendX/JQuery/View/Helper/DialogContainer.php index 6c1772057..4f30d451f 100644 --- a/library/ZendX/JQuery/View/Helper/DialogContainer.php +++ b/library/ZendX/JQuery/View/Helper/DialogContainer.php @@ -1,4 +1,5 @@ _container, $method)) { - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception(sprintf('Invalid method "%s" called on jQuery view helper', $method)); } diff --git a/library/ZendX/JQuery/View/Helper/JQuery/Container.php b/library/ZendX/JQuery/View/Helper/JQuery/Container.php index eb07b6c8e..813d93d99 100644 --- a/library/ZendX/JQuery/View/Helper/JQuery/Container.php +++ b/library/ZendX/JQuery/View/Helper/JQuery/Container.php @@ -1,4 +1,5 @@ _captureLock) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception('Cannot nest onLoad captures'); } @@ -480,8 +474,6 @@ public function onLoadCaptureEnd() public function javascriptCaptureStart() { if ($this->_captureLock) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception('Cannot nest captures'); } diff --git a/library/ZendX/JQuery/View/Helper/Slider.php b/library/ZendX/JQuery/View/Helper/Slider.php index 717c80435..ccadf82ec 100644 --- a/library/ZendX/JQuery/View/Helper/Slider.php +++ b/library/ZendX/JQuery/View/Helper/Slider.php @@ -1,4 +1,5 @@ _captureLock)) { - require_once 'ZendX/JQuery/View/Exception.php'; - throw new ZendX_JQuery_View_Exception(sprintf('Lock already exists for id "%s"', $id)); } @@ -83,8 +82,6 @@ public function captureEnd($id) $name = null; $options = null; if (!array_key_exists($id, $this->_captureLock)) { - require_once 'ZendX/JQuery/View/Exception.php'; - throw new ZendX_JQuery_View_Exception(sprintf('No capture lock exists for id "%s"; nothing to capture', $id)); } diff --git a/phpunit.xml b/phpunit.xml index c04c6a189..a2395144b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,9 @@ - + ./tests/ diff --git a/resources/languages/cs/Zend_Validate.php b/resources/languages/cs/Zend_Validate.php deleted file mode 100644 index cfa35b92d..000000000 --- a/resources/languages/cs/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' obsahuje i jiné znaky než písmena a číslice", - "'%value%' is an empty string" => "'%value%' je prázdný řetězec", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' contains non alphabetic characters" => "'%value%' obsahuje i jiné znaky než písmena", - "'%value%' is an empty string" => "'%value%' je prázdný řetězec", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' má chybný kontrolní součet", - "'%value%' contains invalid characters" => "'%value%' obsahuje neplatné znaky", - "'%value%' should have a length of %length% characters" => "'%value%' by měl mít délku %length% znaků", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec.', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' není mezi '%min%' a '%max%', včetně", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' není ostře mezi '%min%' a '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "Hodnota '%value%' není platná", - 'An exception has been raised within the callback' => 'Během volání byla vyvolána výjimka', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' musí obsahovat 13 až 19 číslic", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhnův algoritmus (kontrolní součet mod-10) nevyšel pro '%value%'", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "'%value%' obsahuje neplatný kontrolní součet", - "'%value%' must contain only digits" => "'%value%' musí obsahovat jen čísla", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' contains an invalid amount of digits" => "'%value%' obsahuje neplatný počet číslic", - "'%value%' is not from an allowed institute" => "'%value%' není od povolené společnosti", - "'%value%' seems to be an invalid creditcard number" => "'%value%' není platné číslo kreditní karty", - "An exception has been raised while validating '%value%'" => "Během validace '%value%' byla vyvolána výjimka", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Chybný typ. Byl očekáván řetězec, číslo, pole nebo Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' není platné datum", - "'%value%' does not fit the date format '%format%'" => "'%value%' neodpovídá formátu data '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Nebyl nalezen žádný záznam odpovídající '%value%'", - "A record matching '%value%' was found" => "Byl nalezen záznam odpovídající '%value%'", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo', - "'%value%' must contain only digits" => "'%value%' musí obsahovat jen číslice", - "'%value%' is an empty string" => "'%value%' je prázdný řetězec", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' is no valid email address in the basic format local-part@hostname" => "'%value%' není platná e-mailová adresa ve formátu local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' není platné hostname pro emailovou adresu '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' neobsahuje platný MX záznam pro e-mailovou adresu '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' není v směrovatelném úseku sítě. E-mailová adresa '%value%' by neměla být požadována z veřejné sítě", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' nemůže být porovnán proti dot-atom formátu", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' nemůže být porovnán proti quoted-string formátu", - "'%localPart%' is no valid local part for email address '%value%'" => "'%localPart%' není platná 'local part' pro e-mailovou adresu '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' překročil dovolenou délku", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Příliš mnoho souborů. Maximum je '%max%', ale bylo zadáno '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Příliš málo souborů. Minimum je '%min%', ale byl zadáno jen '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Soubor '%value%' neodpovídá zadanému crc32 hashi", - 'A crc32 hash could not be evaluated for the given file' => 'Pro zadaný soubor nemohl být vypočítán crc32 hash', - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Soubor '%value%' má nesprávnou příponu", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Soubor '%value%' má nesprávný mimetyp '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp souboru '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Soubor '%value%' neexistuje", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Soubor '%value%' má nesprávnou příponu", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Součet velikostí všech souborů by měl být maximálně '%max%', ale je '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Součet velikostí všech souborů by měl být nejméně '%min%', ale je '%size%'", - 'One or more files can not be read' => 'Jeden nebo více souborů není možné načíst', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Soubor '%value%' neodpovídané danému hashi", - 'A hash could not be evaluated for the given file' => 'Hash nemohl být pro daný soubor vypočítán', - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maximální šířka obrázku '%value%' by měla být '%maxwidth%', ale je '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimální šířka obrázku '%value%' by měla být '%minwidth%', ale je '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maximální výška obrázku '%value%' by měla být '%maxheight%', ale je '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimální výška obrázku '%value%' by měla být '%minheight%', ale je '%height%'", - "The size of image '%value%' could not be detected" => "Rozměry obrázku '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Soubor '%value%' není komprimovaný, ale '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp souboru '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Soubor '%value%' není obrázek, ale '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp souboru '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Soubor '%value%' neodpovídá danému md5 hashi", - 'A md5 hash could not be evaluated for the given file' => 'md5 hash nemohl být pro daný soubor vypočítán', - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Soubor '%value%' má neplatný mimetyp '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp souboru '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Soubor '%value%' již existuje", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Soubor '%value%' neodpovídá danému sha1 hashi", - 'A sha1 hash could not be evaluated for the given file' => 'sha1 hash nemohl být pro daný soubor vypočítán', - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maximální povolená velikost souboru je '%max%', ale '%value%' má '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimální velikost souboru je '%min%', ale '%value%' má '%size%'", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Soubor '%value%' překročil velikost definovanou v ini souboru", - "File '%value%' exceeds the defined form size" => "Soubor '%value%' překročil velikost definovanou ve formuláři", - "File '%value%' was only partially uploaded" => "Soubor '%value%' byl nahrán jen částečně", - "File '%value%' was not uploaded" => "Soubor '%value%' nebyl nahrán", - "No temporary directory was found for file '%value%'" => "Pro soubor '%value%' nebyl nalezen žádný dočasný adresář", - "File '%value%' can't be written" => "Soubor '%value%' nemůže být zapsán", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP rozšíření vrátilo chybu během nahrávání souboru '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Soubor '%value%' byl nedovoleně nahrán. Může se jednat o útok", - "File '%value%' was not found" => "Soubor '%value%' nebyl nalezen", - "Unknown error while uploading file '%value%'" => "Během nahrávání souboru '%value%' došlo k chybě", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Příliš mnoho slov. Je jich dovoleno maximálně '%max%', ale bylo zadáno '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Příliš málo slov. Musí jich být alespoň '%min%', ale bylo zadáno jen '%count%'", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo', - "'%value%' does not appear to be a float" => "'%value%' není desetinné číslo", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' není větší než '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' has not only hexadecimal digit characters" => "'%value%' neobsahuje jen znaky hexadecimálních čísel.", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' vypadá jako IP adresa, ale ty nejsou dovoleny", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' vypadá jako hostname, ale nemohl být ověřen proti známým TLD", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' vypadá jako hostname, ale obsahuje pomlčku na nedovoleném místě", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' vypadá jako hostname, ale neodpovídá formátu hostname pro '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' sice vypadá jako hostname, ale nemohu určit TLD", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' neodpovídá očekáváné struktuře hostname", - "'%value%' does not appear to be a valid local network name" => "'%value%' nevypadá jako platné síťové jméno", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' vypadá jako hostname lokální sítě, ty ale nejsou povoleny", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' vypadá jako DNS hostname ale zadanou punycode notaci není možné dekódovat", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Neznámý stát v IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' není platný formát IBAN", - "'%value%' has failed the IBAN check" => "'%value%' neprošlo kontrolou IBAN", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Zadané položky nejsou shodné', - 'No token was provided to match against' => 'Nebyla zadána položka pro porovnání', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' nebyla nalezena v seznamu", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Chybný typ. Byl očekáván řetězec nebo celé číslo', - "'%value%' does not appear to be an integer" => "'%value%' není celé číslo", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' does not appear to be a valid IP address" => "'%value%' není platná IP adresa", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Chybný typ. Byl očekáván řetězec nebo celé číslo', - "'%value%' is no valid ISBN number" => "'%value%' není platné ISBN", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' není méně než '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo, boolean nebo pole', - "Value is required and can't be empty" => 'Položka je povinná a nesmí být prázdná', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Chybný typ. Byl očekáván řetězec nebo celé číslo', - "'%value%' does not appear to be a postal code" => "'%value%' nevypadá jako PSČ", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' neodpovídá šabloně '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Během zpracování šablony '%pattern%' došlo k interní chybě", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is no valid sitemap changefreq" => "'%value%' není platné 'changefreq' pro sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is no valid sitemap lastmod" => "'%value%' není platné 'lastmod' pro sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - - // Zend_Validate_Sitemap_Loc - "'%value%' is no valid sitemap location" => "'%value%' není platná 'location' pro sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - - // Zend_Validate_Sitemap_Priority - "'%value%' is no valid sitemap priority" => "'%value%' není platná 'priority' pro sitemapu", - 'Invalid type given. Numeric string, integer or float expected' => 'Chybný typ. Byl očekáván číselný řetězec, celé nebo desetinné číslo.', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' is less than %min% characters long" => "'%value%' je kratší než %min% znaků", - "'%value%' is more than %max% characters long" => "'%value%' je delší než %max% znaků", -]; diff --git a/resources/languages/de/Zend_Validate.php b/resources/languages/de/Zend_Validate.php deleted file mode 100644 index b82342ea2..000000000 --- a/resources/languages/de/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Ungültiger Typ angegeben. String, Integer oder Float erwartet', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' enthält Zeichen welche keine Buchstaben und keine Ziffern sind", - "'%value%' is an empty string" => "'%value%' ist ein leerer String", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' contains non alphabetic characters" => "'%value%' enthält Zeichen welche keine Buchstaben sind", - "'%value%' is an empty string" => "'%value%' ist ein leerer String", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' hat die Prüfung der Checksumme nicht bestanden", - "'%value%' contains invalid characters" => "'%value%' enthält ungültige Zeichen", - "'%value%' should have a length of %length% characters" => "'%value%' sollte eine Länge von %length% Zeichen haben", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' ist nicht zwischen '%min%' und '%max%', inklusive diesen Werten", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' ist nicht strikt zwischen '%min%' und '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' ist nicht gültig", - 'An exception has been raised within the callback' => 'Eine Exception wurde im Callback geworfen', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' muss zwischen 13 und 19 Ziffern enthalten", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Der Luhn Algorithmus (Mod-10 Checksumme) ist auf '%value%' fehlgeschlagen", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "'%value%' scheint eine ungültige Prüfsumme zu enthalten", - "'%value%' must contain only digits" => "'%value%' darf nur Ziffern enthalten", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' contains an invalid amount of digits" => "'%value%' enthält eine ungültige Anzahl an Ziffern", - "'%value%' is not from an allowed institute" => "'%value%' ist nicht von einem der erlaubten Institute", - "'%value%' seems to be an invalid creditcard number" => "'%value%' scheint eine ungültige Kreditkarten-Nummer zu sein", - "An exception has been raised while validating '%value%'" => "Eine Exception wurde wärend der Prüfung von '%value%' geworfen", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Ungültiger Typ angegeben. String, Integer, Array oder Zend_Date erwartet', - "'%value%' does not appear to be a valid date" => "'%value%' scheint kein gültiges Datum zu sein", - "'%value%' does not fit the date format '%format%'" => "'%value%' passt nicht in das angegebene Datumsformat '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Es wurde kein Eintrag gefunden der '%value%' entspricht", - "A record matching '%value%' was found" => "Ein Eintrag der '%value%' entspricht wurde gefunden", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Ungültiger Typ angegeben. String, Integer oder Float erwartet', - "'%value%' must contain only digits" => "'%value%' darf nur Ziffern enthalten", - "'%value%' is an empty string" => "'%value%' ist ein leerer String", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' ist keine gültige Emailadresse im Basisformat local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' ist kein gültiger Hostname für die Emailadresse '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' scheint keinen gültigen MX Eintrag für die Emailadresse '%value%' zu haben", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' ist in keinem routebaren Netzwerksegment. Die Emailadresse '%value%' sollte nicht vom öffentlichen Netz aus aufgelöst werden", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' passt nicht auf das dot-atom Format", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' passt nicht auf das quoted-string Format", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' ist kein gültiger lokaler Teil für die Emailadresse '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' ist länger als erlaubt", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Zu viele Dateien. Maximal '%max%' sind erlaubt aber '%count%' wurden angegeben", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Zu wenige Dateien. Minimal '%min%' wurden erwartet aber nur '%count%' wurden angegeben", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Die Datei '%value%' passt nicht auf die angegebenen Crc32 Hashes", - 'A crc32 hash could not be evaluated for the given file' => 'Für die angegebene Datei konnte kein Crc32 Hash evaluiert werden', - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Die Datei '%value%' hat eine falsche Erweiterung", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Die Datei '%value%' hat einen falschen Mimetyp von '%type%'", - "The mimetype of file '%value%' could not be detected" => "Der Mimetyp der Datei '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Die Datei '%value%' existiert nicht", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Die Datei '%value%' hat eine falsche Erweiterung", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Alle Dateien sollten in Summe eine maximale Größe von '%max%' haben, aber es wurde '%size%' erkannt", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Alle Dateien sollten in Summe eine minimale Größe von '%min%' haben, aber es wurde '%size%' erkannt", - 'One or more files can not be read' => 'Ein oder mehrere Dateien konnten nicht gelesen werden', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Die Datei '%value%' passt nicht auf die angegebenen Hashes", - 'A hash could not be evaluated for the given file' => 'Für die angegebene Datei konnte kein Hash evaluiert werden', - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Die maximal erlaubte Breite für das Bild '%value%' ist '%maxwidth%', aber es wurde '%width%' erkannt", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Die minimal erlaubte Breite für das Bild '%value%' ist '%minwidth%', aber es wurde '%width%' erkannt", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Die maximal erlaubte Höhe für das Bild '%value%' ist '%maxheight%', aber es wurde '%height%' erkannt", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Die minimal erlaubte Höhe für das Bild '%value%' ist '%minheight%', aber es wurde '%height%' erkannt", - "The size of image '%value%' could not be detected" => "Die Größe des Bildes '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Die Datei '%value%' ist nicht komprimiert. Es wurde '%type%' erkannt", - "The mimetype of file '%value%' could not be detected" => "Der Mimetyp der Datei '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Die Datei '%value%' ist kein Bild. Es wurde '%type%' erkannt", - "The mimetype of file '%value%' could not be detected" => "Der Mimetyp der Datei '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Die Datei '%value%' passt nicht auf die angegebenen Md5 Hashes", - 'A md5 hash could not be evaluated for the given file' => 'Für die angegebene Datei konnte kein Md5 Hash evaluiert werden', - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Die Datei '%value%' hat einen falschen Mimetyp von '%type%'", - "The mimetype of file '%value%' could not be detected" => "Der Mimetyp der Datei '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Die Datei '%value%' existiert bereits", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Die Datei '%value%' passt nicht auf die angegebenen Sha1 Hashes", - 'A sha1 hash could not be evaluated for the given file' => 'Für die angegebene Datei konnte kein Sha1 Hash evaluiert werden', - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Die maximal erlaubte Größe für die Datei '%value%' ist '%max%', aber es wurde '%size%' entdeckt", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Die mindestens erwartete Größe für die Datei '%value%' ist '%min%', aber es wurde '%size%' entdeckt", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Die Datei '%value%' übersteigt die definierte Größe in der Konfiguration", - "File '%value%' exceeds the defined form size" => "Die Datei '%value%' übersteigt die definierte Größe des Formulars", - "File '%value%' was only partially uploaded" => "Die Datei '%value%' wurde nur teilweise hochgeladen", - "File '%value%' was not uploaded" => "Die Datei '%value%' wurde nicht hochgeladen", - "No temporary directory was found for file '%value%'" => "Für die Datei '%value%' wurde kein temporäres Verzeichnis gefunden", - "File '%value%' can't be written" => "Die Datei '%value%' konnte nicht geschrieben werden", - "A PHP extension returned an error while uploading the file '%value%'" => "Eine PHP Erweiterung retournierte einen Fehler wärend die Datei '%value%' hochgeladen wurde", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Die Datei '%value%' wurde illegal hochgeladen. Dies könnte eine mögliche Attacke sein", - "File '%value%' was not found" => "Die Datei '%value%' wurde nicht gefunden", - "Unknown error while uploading file '%value%'" => "Ein unbekannter Fehler ist aufgetreten wärend die Datei '%value%' hochgeladen wurde", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Zu viele Wörter. Maximal '%max%' sind erlaubt, aber '%count%' wurden gezählt", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Zu wenige Wörter. Mindestens '%min%' wurden erwartet, aber '%count%' wurden gezählt", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Ungültiger Typ angegeben. String, Integer oder Float erwartet', - "'%value%' does not appear to be a float" => "'%value%' scheint kein Float zu sein", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' ist nicht größer als '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' has not only hexadecimal digit characters" => "'%value%' enthält nicht nur hexadezimale Ziffern", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' scheint eine IP Adresse zu sein, aber IP Adressen sind nicht erlaubt", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' scheint ein DNS Hostname zu sein, aber die TLD wurde in der bekannten Liste nicht gefunden", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' scheint ein DNS Hostname zu sein, enthält aber einen Bindestrich an einer ungültigen Position", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' scheint ein DNS Hostname zu sein, passt aber nicht in das Hostname Schema für die TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' scheint ein DNS Hostname zu sein, aber der TLD Teil konnte nicht extrahiert werden", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' passt nicht in die erwartete Struktur für einen DNS Hostname", - "'%value%' does not appear to be a valid local network name" => "'%value%' scheint kein gültiger lokaler Netzerkname zu sein", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' scheint ein lokaler Netzwerkname zu sein, aber lokale Netzwerknamen sind nicht erlaubt", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' scheint ein DNS Hostname zu sein, aber die angegebene Punycode Schreibweise konnte nicht dekodiert werden", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Unbekanntes Land in der IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' enthält ein falsches IBAN Format", - "'%value%' has failed the IBAN check" => "Die IBAN Prüfung ist für '%value%' fehlgeschlagen", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Die zwei angegebenen Token stimmen nicht überein', - 'No token was provided to match against' => 'Es wurde kein Token angegeben gegen den geprüft werden kann', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' wurde im Haystack nicht gefunden", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Ungültiger Typ angegeben. String oder Integer erwartet', - "'%value%' does not appear to be an integer" => "'%value%' scheint kein Integer zu sein", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' does not appear to be a valid IP address" => "'%value%' scheint keine gültige IP Adresse zu sein", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Ungültiger Typ angegeben. String oder Integer erwartet', - "'%value%' is not a valid ISBN number" => "'%value%' ist keine gültige ISBN Nummer", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' ist nicht weniger als '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Ungültiger Typ angegeben. String, Integer, Float, Boolean oder Array erwartet', - "Value is required and can't be empty" => 'Es wird ein Wert benötigt. Dieser darf nicht leer sein', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Ungültiger Typ angegeben. String oder Integer erwartet', - "'%value%' does not appear to be a postal code" => "'%value%' scheint keine gültige Postleitzahl zu sein", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Ungültiger Typ angegeben. String, Integer oder Float erwartet', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' scheint nicht auf das Pattern '%pattern%' zu passen", - "There was an internal error while using the pattern '%pattern%'" => "Es gab einen internen Fehler bei der Verwendung des Patterns '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' ist keine gültige Changefreq für Sitemap", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' ist keine gültige Lastmod für Sitemap", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' ist keine gültige Location für Sitemap", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' ist keine gültige Priority für Sitemap", - 'Invalid type given. Numeric string, integer or float expected' => 'Ungültiger Typ angegeben. Nummerischer String, Integer oder Float erwartet', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' is less than %min% characters long" => "'%value%' ist weniger als %min% Zeichen lang", - "'%value%' is more than %max% characters long" => "'%value%' ist mehr als %max% Zeichen lang", -]; diff --git a/resources/languages/en/Zend_Validate.php b/resources/languages/en/Zend_Validate.php deleted file mode 100644 index 99f95907a..000000000 --- a/resources/languages/en/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Invalid type given. String, integer or float expected', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contains characters which are non alphabetic and no digits", - "'%value%' is an empty string" => "'%value%' is an empty string", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' contains non alphabetic characters" => "'%value%' contains non alphabetic characters", - "'%value%' is an empty string" => "'%value%' is an empty string", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' failed checksum validation", - "'%value%' contains invalid characters" => "'%value%' contains invalid characters", - "'%value%' should have a length of %length% characters" => "'%value%' should have a length of %length% characters", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' is not between '%min%' and '%max%', inclusively", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' is not strictly between '%min%' and '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' is not valid", - 'An exception has been raised within the callback' => 'An exception has been raised within the callback', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' must contain between 13 and 19 digits", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algorithm (mod-10 checksum) failed on '%value%'", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "'%value%' seems to contain an invalid checksum", - "'%value%' must contain only digits" => "'%value%' must contain only digits", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' contains an invalid amount of digits" => "'%value%' contains an invalid amount of digits", - "'%value%' is not from an allowed institute" => "'%value%' is not from an allowed institute", - "'%value%' seems to be an invalid creditcard number" => "'%value%' seems to be an invalid creditcard number", - "An exception has been raised while validating '%value%'" => "An exception has been raised while validating '%value%'", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Invalid type given. String, integer, array or Zend_Date expected', - "'%value%' does not appear to be a valid date" => "'%value%' does not appear to be a valid date", - "'%value%' does not fit the date format '%format%'" => "'%value%' does not fit the date format '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "No record matching '%value%' was found", - "A record matching '%value%' was found" => "A record matching '%value%' was found", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Invalid type given. String, integer or float expected', - "'%value%' must contain only digits" => "'%value%' must contain only digits", - "'%value%' is an empty string" => "'%value%' is an empty string", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' is not a valid email address in the basic format local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' is not a valid hostname for email address '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' can not be matched against dot-atom format", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' can not be matched against quoted-string format", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' is not a valid local part for email address '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' exceeds the allowed length", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Too many files, maximum '%max%' are allowed but '%count%' are given", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Too few files, minimum '%min%' are expected but '%count%' are given", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "File '%value%' does not match the given crc32 hashes", - 'A crc32 hash could not be evaluated for the given file' => 'A crc32 hash could not be evaluated for the given file', - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "File '%value%' has a false extension", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "File '%value%' has a false mimetype of '%type%'", - "The mimetype of file '%value%' could not be detected" => "The mimetype of file '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "File '%value%' does not exist", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "File '%value%' has a false extension", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "All files in sum should have a maximum size of '%max%' but '%size%' were detected", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "All files in sum should have a minimum size of '%min%' but '%size%' were detected", - 'One or more files can not be read' => 'One or more files can not be read', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "File '%value%' does not match the given hashes", - 'A hash could not be evaluated for the given file' => 'A hash could not be evaluated for the given file', - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected", - "The size of image '%value%' could not be detected" => "The size of image '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "File '%value%' is not compressed, '%type%' detected", - "The mimetype of file '%value%' could not be detected" => "The mimetype of file '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "File '%value%' is no image, '%type%' detected", - "The mimetype of file '%value%' could not be detected" => "The mimetype of file '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "File '%value%' does not match the given md5 hashes", - 'A md5 hash could not be evaluated for the given file' => 'A md5 hash could not be evaluated for the given file', - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "File '%value%' has a false mimetype of '%type%'", - "The mimetype of file '%value%' could not be detected" => "The mimetype of file '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "File '%value%' exists", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "File '%value%' does not match the given sha1 hashes", - 'A sha1 hash could not be evaluated for the given file' => 'A sha1 hash could not be evaluated for the given file', - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimum expected size for file '%value%' is '%min%' but '%size%' detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "File '%value%' exceeds the defined ini size", - "File '%value%' exceeds the defined form size" => "File '%value%' exceeds the defined form size", - "File '%value%' was only partially uploaded" => "File '%value%' was only partially uploaded", - "File '%value%' was not uploaded" => "File '%value%' was not uploaded", - "No temporary directory was found for file '%value%'" => "No temporary directory was found for file '%value%'", - "File '%value%' can't be written" => "File '%value%' can't be written", - "A PHP extension returned an error while uploading the file '%value%'" => "A PHP extension returned an error while uploading the file '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "File '%value%' was illegally uploaded. This could be a possible attack", - "File '%value%' was not found" => "File '%value%' was not found", - "Unknown error while uploading file '%value%'" => "Unknown error while uploading file '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Too much words, maximum '%max%' are allowed but '%count%' were counted", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Too less words, minimum '%min%' are expected but '%count%' were counted", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Invalid type given. String, integer or float expected', - "'%value%' does not appear to be a float" => "'%value%' does not appear to be a float", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' is not greater than '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' has not only hexadecimal digit characters" => "'%value%' has not only hexadecimal digit characters", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' appears to be an IP address, but IP addresses are not allowed", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' appears to be a DNS hostname but cannot match TLD against known list", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' appears to be a DNS hostname but contains a dash in an invalid position", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' appears to be a DNS hostname but cannot extract TLD part", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' does not match the expected structure for a DNS hostname", - "'%value%' does not appear to be a valid local network name" => "'%value%' does not appear to be a valid local network name", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' appears to be a local network name but local network names are not allowed", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Unknown country within the IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' has a false IBAN format", - "'%value%' has failed the IBAN check" => "'%value%' has failed the IBAN check", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'The two given tokens do not match', - 'No token was provided to match against' => 'No token was provided to match against', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' was not found in the haystack", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Invalid type given. String or integer expected', - "'%value%' does not appear to be an integer" => "'%value%' does not appear to be an integer", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' does not appear to be a valid IP address" => "'%value%' does not appear to be a valid IP address", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Invalid type given. String or integer expected', - "'%value%' is not a valid ISBN number" => "'%value%' is not a valid ISBN number", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' is not less than '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Invalid type given. String, integer, float, boolean or array expected', - "Value is required and can't be empty" => "Value is required and can't be empty", - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Invalid type given. String or integer expected', - "'%value%' does not appear to be a postal code" => "'%value%' does not appear to be a postal code", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Invalid type given. String, integer or float expected', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' does not match against pattern '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "There was an internal error while using the pattern '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' is not a valid sitemap changefreq", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' is not a valid sitemap lastmod", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' is not a valid sitemap location", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' is not a valid sitemap priority", - 'Invalid type given. Numeric string, integer or float expected' => 'Invalid type given. Numeric string, integer or float expected', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' is less than %min% characters long" => "'%value%' is less than %min% characters long", - "'%value%' is more than %max% characters long" => "'%value%' is more than %max% characters long", -]; diff --git a/resources/languages/es/Zend_Validate.php b/resources/languages/es/Zend_Validate.php deleted file mode 100644 index aef9e8fed..000000000 --- a/resources/languages/es/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'El tipo especificado no es válido, el valor debe ser de tipo float, una cadena de texto o entero', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contiene caracteres que no son alfabéticos ni dígitos", - "'%value%' is an empty string" => "'%value%' es una cadena de texto vacia", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto', - "'%value%' contains non alphabetic characters" => "'%value%' contiene caracteres no alfabéticos", - "'%value%' is an empty string" => "'%value%' es una cadena de texto vacia", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' Fallo la validación de checksum", - "'%value%' contains invalid characters" => "'%value%' contiene caracteres no válidos", - "'%value%' should have a length of %length% characters" => "'%value%' debe tener una longitud de %length% caracteres", - 'Invalid type given, value should be string' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' no está incluido entre '%min%' y '%max%'", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' no está exactamente entre '%min%' y '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' no es válido", - 'Failure within the callback, exception returned' => 'Falló dentro de la llamada de retorno, ha devuelto una excepción', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' debe contener entre 13 y 19 dígitos", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "El algoritmo de Luhn (checksum del módulo 10) fallo en '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "El algoritmo de Luhn (checksum del módulo 10) fallo en '%value%'", - "'%value%' must contain only digits" => "'%value%' debe contener solo dígitos", - 'Invalid type given, value should be a string' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto', - "'%value%' contains an invalid amount of digits" => "'%value%' contiene una cantidad inválida de dígitos", - "'%value%' is not from an allowed institute" => "'%value%' no es de una institución autorizada", - "Validation of '%value%' has been failed by the service" => "La validación de '%value%' fallo por causa del servicio", - "The service returned a failure while validating '%value%'" => "El servicio devolvió un fallo durante la validación de '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto, entero, array o un objeto Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' no parece ser una fecha válida", - "'%value%' does not fit the date format '%format%'" => "'%value%' no se ajusta al formato de fecha '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'No fue encontrado ningun registro que coincida con %value%', - "A record matching '%value%' was found" => 'Se encontro un registro coincidente con %value%', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto, entero o float', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' contiene caracteres que no son dígitos, solo se permiten dígitos", - "'%value%' is an empty string" => "'%value%' es una cadena vacía", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto', - "'%value%' is no valid email address in the basic format local-part@hostname" => "'%value%' no es una dirección de correo electrónico válido en el formato local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' no es un nombre de host válido para la dirección de correo electrónico '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' no parece tener un registro MX válido para la dirección de correo electrónico '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' no esta en un segmento de red ruteable. La dirección de correo electrónico '%value%' no se debe poder resolver desde una red pública.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' no es igual al formato dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' no es igual al formato quoted-string", - "'%localPart%' is no valid local part for email address '%value%'" => "'%localPart%' no es una parte local válida para la dirección de correo electrónico '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' excede la longitud permitida", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Demasiados archivos, se permiten un máximo de '%max%' pero se han especificado '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Muy pocos archivos, se esperaba un mí­nimo de '%min%' pero sólo se han especificado '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "El CRC32 del archivo '%value%' es incorrecto", - 'A crc32 hash could not be evaluated for the given file' => 'No se ha podido calcular el CRC32 del archivo especificado', - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "El archivo '%value%' tiene una extensión incorrecta", - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "El archivo '%value%' tiene un tipo MIME '%type%' incorrecto", - "The mimetype of file '%value%' could not be detected" => "No se ha podido determinar el tipo MIME del archivo '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "El archivo '%value%' no existe", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "El archivo '%value%' tiene una extensión incorrecta", - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Todos los archivos deberí­an tener un tamaño máximo de '%max%' pero tiene un tamaño de '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Todos los archivos deberí­an tener un tamaño mí­nimo de '%min%' pero tiene un tamaño de '%size%'", - 'One or more files can not be read' => 'Uno o más archivos no se pueden leer', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "El archivo '%value%' no se corresponde con los códigos hash especificados", - 'A hash could not be evaluated for the given file' => 'No se ha podido evaluar ningún código hash para el archivo especificado', - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "El ancho máxima para la imagen '%value%' deberí­a ser '%maxwidth%' pero es de '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "El ancho mí­nima para la imagen '%value%' deberí­a ser '%minwidth%' pero es de '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "La altura máxima para la imagen '%value%' deberí­a ser '%maxheight%' pero es de '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "La altura mí­nima para la imagen '%value%' deberí­a ser '%minheight%' pero es de '%height%'", - "The size of image '%value%' could not be detected" => "No se ha podido determinar el tamaño de la imagen '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "El archivo '%value%' no está comprimido, '%type%' detectado", - "The mimetype of file '%value%' could not be detected" => "No se ha podido determinar el tipo MIME del archivo '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "El archivo '%value%' no es una imagen, '%type%' detectado", - "The mimetype of file '%value%' could not be detected" => "No se ha podido determinar el tipo MIME del archivo '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "El archivo '%value%' no se corresponde con el MD5 especificado", - 'A md5 hash could not be evaluated for the given file' => 'No se ha podido calcular el MD5 del archivo especificado', - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "El archivo '%value%' tiene un tipo MIME '%type%' falso", - "The mimetype of file '%value%' could not be detected" => "No se ha podido determinar el tipo MIME del archivo '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "El archivo '%value%' existe", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "El archivo '%value%' no es igual al SHA1 especificado", - 'A sha1 hash could not be evaluated for the given file' => 'No se ha podido calcular el SHA1 del archivo especificado', - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "El tamaño máximo permitido para el archivo '%value%' es '%max%' pero se ha detectado un tamaño de '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "El tamaño mí­nimo permitido para el archivo '%value%' es '%min%' pero se ha detectado un tamaño de '%size%'", - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "El tamaño del archivo '%value%' excede el valor definido en el ini", - "File '%value%' exceeds the defined form size" => "El archivo '%value%' excede el tamaño definido en el formulario", - "File '%value%' was only partially uploaded" => "El archivo '%value%' ha sido sólo parcialmente subido", - "File '%value%' was not uploaded" => "El archivo '%value%' no ha sido subido", - "No temporary directory was found for file '%value%'" => "No se ha encontrado el directorio temporal para el archivo '%value%'", - "File '%value%' can't be written" => "No se puede escribir en el archivo '%value%'", - "A PHP extension returned an error while uploading the file '%value%'" => "Una extensión PHP devolvió un error mientras se subí­a el archivo '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "El archivo '%value%' ha sido subido ilegalmente, lo cual podrí­a ser un ataque", - "File '%value%' was not found" => "Archivo '%value%' no encontrado", - "Unknown error while uploading file '%value%'" => "error desconocido al intentar subir el archivo '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Demasiadas palabras, sólo se permiten '%max%' pero se han contado '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Demasiado pocas palabras, se esperaban al menos '%min%' pero se han contado '%count%'", - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'El tipo especificado no es válido, el valor deberí­a ser de tipo float, una cadena de texto o un entero', - "'%value%' does not appear to be a float" => "'%value%' no parece ser un float", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' no es mayor que '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' has not only hexadecimal digit characters" => "'%value%' no consta únicamente de dí­gitos y caracteres hexadecimales", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' parece una dirección IP, pero éstas no están permitidas", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' parece ser un nombre de dominio DNS pero el TLD no es válido", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' parece ser un nombre de dominio DNS pero contiene una barra en una posición inválida", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' parece ser un nombre de dominio DNS pero su formato no se corresponde con el correcto para el TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' parece ser un nombre de dominio DNS pero no se puede extraer la parte del TLD", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' no se corresponde con la estructura esperada para un nombre de dominio DNS", - "'%value%' does not appear to be a valid local network name" => "'%value%' no parece ser un nombre de área local válido", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' parece ser un nombre de área local pero no se permiten nombres de área local", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' parece ser un nombre de dominio DNS pero no se puede decodificar la notación de punycode", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Paí­s desconocido dentro del IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' tiene un formato falso de IBAN", - "'%value%' has failed the IBAN check" => "La prueba de validación de IBAN de '%value%' ha fallado", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Las dos muestras especificados no concuerdan', - 'No token was provided to match against' => 'No se ha especificado ninguna muestra a comprobar', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "No se ha encontrado '%value%' en el argumento especificado", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto o un entero', - "'%value%' does not appear to be an integer" => "'%value%' no parece ser un entero", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' does not appear to be a valid IP address" => "'%value%' no parece ser una dirección IP válida", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto o un entero', - "'%value%' is not a valid ISBN number" => "El número ISBN especificado ('%value%') no es válido", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' no es menor que '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'El tipo especificado es inválido, el valor deberí­a ser un float, una cadena de texto, un array, un boolean o un entero', - "Value is required and can't be empty" => 'Se requiere un valor y éste no puede estar vací­o', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' does not appear to be a postal code" => "'%value%' no parece ser un código postal", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'El tipo especificado es incorrecto, el valor deberí­a ser de tipo float, una cadena de texto o un entero', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' no concuerda con el patrón '%pattern%' especificado", - "There was an internal error while using the pattern '%pattern%'" => "Se ha producido un error interno al usar el patrón '%pattern%' especificado", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' no es una especificación válida de frecuencia de cambio", - 'Invalid type given, the value should be a string' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' no es un lastmod de mapa web válido", - 'Invalid type given, the value should be a string' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' no es una ubicación de mapa web válida", - 'Invalid type given, the value should be a string' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' no es una prioridad de mapa web válida", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'El tipo especificado es inválido, el valor deberí­a ser un entero, un float o una cadena de texto numérica', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' is less than %min% characters long" => "'%value%' tiene menos de '%min%' caracteres", - "'%value%' is more than %max% characters long" => "'%value%' tiene más de '%max%' caracteres", -]; diff --git a/resources/languages/fi/Zend_Validate.php b/resources/languages/fi/Zend_Validate.php deleted file mode 100644 index b72bbfda2..000000000 --- a/resources/languages/fi/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Epäkelpo syöte. Pitäisi olla liukuluku, merkkijono tai kokonaisluku', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' on virheelinen, ainoastaan aakkoset ja numerot ovat sallittuja", - "'%value%' is an empty string" => "'%value%' on tyhjä merkkijono", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' contains non alphabetic characters" => "'%value%' on virheellinen, ainoastaan aakkoset ovat sallittuja", - "'%value%' is an empty string" => "'%value%' on tyhjä merkkijono", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "Syötteen '%value%' tarkistusluvun vahvistus epäonnistui", - "'%value%' contains invalid characters" => "'%value%' sisältää epäkelpoja merkkejä", - "'%value%' should have a length of %length% characters" => "'%value%' pitäisi olla %length% merkkiä pitkä", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' ei ole luku väliltä %min%-%max%", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' ei ole luku väliltä %min%-%max%, poislukien ylä- ja alarajat", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' on epäkelpo", - 'An exception has been raised within the callback' => 'Odottamaton virhe, callback-validaattori palautti poikkeuksen', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' pitää olla luku väliltä 13-19", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn-algoritmin (mod 10) suoritus syötteelle '%value%' epäonnistui", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "Syötteen '%value%' tarkistusluku on viallinen", - "'%value%' must contain only digits" => "'%value%' saa sisältää ainoastaan numeroita", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' contains an invalid amount of digits" => "'%value%' sisältää väärän määrän numeroita", - "'%value%' is not from an allowed institute" => "'%value%' ei ole sallitun luottolaitoksen alkuosa", - "'%value%' seems to be an invalid creditcard number" => "Luottokortin numero '%value%' tulkittiin virheelliseksi", - "An exception has been raised while validating '%value%'" => "Kortin '%value%' varmennus epäonnistui, palvelu palautti virheen", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono, kokonaisluku, taulukko tai Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' ei ole kelvollinen päivä", - "'%value%' does not fit the date format '%format%'" => "'%value%' ei ole muotoa '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Rekisteristä ei löytynyt arvoa, joka vastaisi syötettä '%value%'", - "A record matching '%value%' was found" => "Rekisteristä löytyi syötettä '%value%' vastaava arvo", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono, kokonaisluku tai liukuluku', - "'%value%' must contain only digits" => "'%value%' on virheellinen, ainoastaan numerot ovat sallittuja", - "'%value%' is an empty string" => "'%value%' on tyhjä merkkijono", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' on virheellinen sähköpostiosoite, ei vastaa muotoa paikallisosa@alue", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' on virheellinen verkkotunnus osoitteelle '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "Osoitteen '%value%' verkkotunnukselle '%hostname%' ei löydy MX-tietuetta", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' ei ole reititettävän verkon osa. Sähköpostiosoitetta '%value%' ei pitäisi selvittää julkisesta verkosta.", - "'%localPart%' can not be matched against dot-atom format" => "Virheellinen paikallisosa, '%localPart%' ei ole verrattavissa dot-atom -muotoon", - "'%localPart%' can not be matched against quoted-string format" => "Virheellinen paikallisosa, '%localPart%' ei ole verrattavissa quoted-string -muotoon", - "'%localPart%' is not a valid local part for email address '%value%'" => "Sähköpostiosoitteen '%value%' paikallisosa '%localPart%' on virheellinen", - "'%value%' exceeds the allowed length" => "Osoite '%value%' on liian pitkä", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Virheellinen määrä tiedostoja, maksimimäärä on '%max%', vastaanotettiin '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Virheellinen määrä tiedostoja, minimimäärä on '%min%', vastaanotettiin '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Tiedoston '%value%' crc32-tarkistusluku ei vastaa annettua", - 'A crc32 hash could not be evaluated for the given file' => 'Tarkistuslukua crc32 ei pystytty määrittämään vastaanotetulle tiedostolle', - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Tiedostolla '%value%' on virheellinen pääte", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Tiedoston '%value%' MIME-tyyppi '%type%' on virheellinen", - "The mimetype of file '%value%' could not be detected" => "Tiedoston '%value%' MIME-tyyppiä ei pystytty todentamaan", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Tiedostoa '%value%' ei ole olemassa", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Tiedostolla '%value%' on virheellinen pääte", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Kaikkien tiedostojen yhteenlaskettu koko saa olla maksimissaan '%max%', vastaanotettiin '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Kaikkien tiedostojen yhteenlaskettu koko pitää olla vähintään '%min%', vastaanotettiin '%size%'", - 'One or more files can not be read' => 'Yhtä tai useampaa tiedostoa ei voida lukea', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Tiedoston '%value%' tarkastusluku ei vastaa annettua", - 'A hash could not be evaluated for the given file' => 'Tarkistuslukua ei pystytty määrittämään vastaanotetulle tiedostolle', - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Kuvan '%value%' maksimileveys on '%maxwidth%', annettu '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Kuvan '%value%' minimileveys on '%minwidth%', annettu '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Kuvan '%value%' maksimikorkeus on '%maxheight%', annettu '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Kuvan '%value%' minimikorkeus on '%minheight%', annettu '%height%'", - "The size of image '%value%' could not be detected" => "Kuvan '%value%' kokoa ei voida todentaa", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Tiedosto '%value%' ei ole pakattu, vastaanotettiin tyyppiä '%type%'", - "The mimetype of file '%value%' could not be detected" => "Tiedoston '%value%' MIME-tyyppiä ei pystytty todentamaan", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Tiedosto '%value%' ei ole kuvatiedosto, vastaanotettiin tyyppiä '%type%'", - "The mimetype of file '%value%' could not be detected" => "Tiedoston '%value%' MIME-tyyppiä ei pystytty todentamaan", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Tiedoston '%value%' tarkistusluku ei vastaa annettua (md5)", - 'A md5 hash could not be evaluated for the given file' => 'Tiedostolle ei voitu määrittää md5-tarkistuslukua', - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Tiedoston '%value%' MIME-tyyppi '%type%' on virheellinen", - "The mimetype of file '%value%' could not be detected" => "Tiedoston '%value%' MIME-tyyppiä ei pystytty todentamaan", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Tiedostoa '%value%' ei ole olemassa", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Tiedoston '%value%' tarkistusluku ei vastaa annettua (sha1)", - 'A sha1 hash could not be evaluated for the given file' => 'Tiedostolle ei voitu määrittää sha1-tarkistuslukua', - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Tiedoston '%value%' maksimikoko on '%max%', vastaanotettu '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Tiedoston '%value%' minimikoko on '%min%', vastaanotettu '%size%'", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voidea lukea tai sitä ei ole", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Tiedosto '%value%' ylittää ini-tiedostossa määritellyn tiedostokoon", - "File '%value%' exceeds the defined form size" => "Tiedosto '%value%' ylittää lomakkeessa määritellyn tiedostokoon", - "File '%value%' was only partially uploaded" => "Tiedosto '%value%' vastaanotettiin ainoastaan osittain", - "File '%value%' was not uploaded" => "Tiedostoa '%value%' ei lähetetty", - "No temporary directory was found for file '%value%'" => "Väliaikaishakemistoa ei löytynyt tiedostolle '%value%'", - "File '%value%' can't be written" => "Tiedostoon '%value%' ei voida kirjoittaa", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP:n lisäosa palautti virheen kesken tiedoston '%value%' lähetyksen", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Tiedoston '%value%' lähetyksessä haivattu laittomuus, mahdollinen hyökkäys", - "File '%value%' was not found" => "Tiedostoa '%value%' ei löydy", - "Unknown error while uploading file '%value%'" => "Tiedoston '%value%' lähetyksessä tapahtui tunnistamaton virhe", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Virheellinen määrä sanoja, maksimäärä on '%max%', annettu '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Virheellinen määrä sanoja, minimimäärä on '%min%', annettu '%count%'", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Epäkelpo syöte. Pitäisi olla liukuluku, merkkijono tai kokonaisluku', - "'%value%' does not appear to be a float" => "'%value%' ei ole liukuluku", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' ei ole suurempi kuin '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' has not only hexadecimal digit characters" => "'%value%' voi sisältää ainoastaan heksadeslimaalin muotoisia merkkejä", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' näyttäisi olevan ip-osoite eikä verkkotunnus", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' verkkotunnuksen TLD-osa ei ole tunnettu", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' näyttäisi olevan käypä verkkotunnus, mutta sisältää viivan väärässä paikassa", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' näyttäisi olevan käypä verkkotunnus, mutta sen TLD-osa '%tld%' on virheellinen", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' verkkotunnuksen TLD-osaa ei pystytty erottamaan", - "'%value%' does not match the expected structure for a DNS hostname" => "Verkkotunnus '%value%' on jäsennykseltään virheellinen", - "'%value%' does not appear to be a valid local network name" => "'%value%' on epäkelpo paikallisverkkon tunnus", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' tulkittiin paikallisverkon tunnukseksi, jotka eivät ole sallittuja", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "Verkkotunnuksen '%value%' punycode-koodauksen purku epäonnistui", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Maata ei pystytty tunnistamaan IBAN-koodista '%value%'", - "'%value%' has a false IBAN format" => "'%value%' on väärän muotoinen IBAN-koodi", - "'%value%' has failed the IBAN check" => "'%value%' IBAN-koodin tarkastus epäonnistui", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Annetut kaksi arvoa eivät täsmää', - 'No token was provided to match against' => 'Toinen arvoista puuttuu', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' ei löydy sallittujen syötteiden joukosta", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono tai kokonaisluku', - "'%value%' does not appear to be an integer" => "'%value%' ei ole kokonaisluku", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' does not appear to be a valid IP address" => "'%value%' ei ole käypä IP-osoite", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono tai kokonaisluku', - "'%value%' is not a valid ISBN number" => "'%value%' ei ole käypä ISBN-numero", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' ei ole pienempi kuin '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Epäkelpo syöte. Pitäisi olla kokonaisluku, liukuluku, boolean tai taulukko', - "Value is required and can't be empty" => 'Kenttä ei voi olla tyhjä', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono tai kokonaisluku', - "'%value%' does not appear to be a postal code" => "'%value%' ei ole käypä postiosoite", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono, kokonaisluku tai liukuluku', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' ei ole muotoa '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Sisäinen virhe käytettäessa muotoa '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' ei ole käypä sivukartan muutosnopeus", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' ei ole käypä arvo sivukartan viimeksimuokatuksi arvoksi", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' ei ole käypä sivukartan sijainti", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' ei ole käypä sivukartan prioriteetti", - 'Invalid type given. Numeric string, integer or float expected' => 'Epäkelpo syöte. Pitäisi olla kokonaisluku tai liukuluku', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' is less than %min% characters long" => "'%value%' on lyhyempi kuin vaaditut %min% merkkiä", - "'%value%' is more than %max% characters long" => "'%value%' on pidempi kuin sallitut %max% merkkiä", -]; diff --git a/resources/languages/fr/Zend_Validate.php b/resources/languages/fr/Zend_Validate.php deleted file mode 100644 index 4095b73fd..000000000 --- a/resources/languages/fr/Zend_Validate.php +++ /dev/null @@ -1,130 +0,0 @@ - "'%hostname%' ne semble pas avoir d'enregistrement MX valide pour l'adresse email '%value%'", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' n'est pas un nom d'hôte valide pour l'adresse email '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' n'est pas dans un segment réseau routable. L'adresse email '%value%' ne devrait pas être résolue depuis un réseau public.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' ne correspond pas au format dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' ne correspond pas au format quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' n'est pas une partie locale valide pour l'adresse email '%value%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' semble être un nom d'hôte DNS mais l'extension TLD ne peut être extraite", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' semble être un nom d'hôte DNS mais son extension TLD semble inconnue", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' semble être un nom d'hôte DNS valide mais ne correspond pas au schéma de l'extension TLD '%tld%'", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' semble être un nom d'hôte DNS mais il contient un tiret à une position invalide", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' semble être un DNS valide mais le code n'a pu être décodé", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' semble être un nom réseau local mais les noms locaux sont interdits", - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' semble être une IP valide mais celles-ci ne sont pas autorisées", - "'%value%' contains an invalid amount of digits" => "'%value%' contient un nombre incorrect de chiffres", - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contient des caractères non alphabétiques et non numériques", - "'%value%' contains invalid characters" => "'%value%' contient des caractères invalides", - "'%value%' contains non alphabetic characters" => "'%value%' contient des caractères non alphabétiques", - "'%value%' does not appear to be a float" => "'%value%' ne semble pas être de type flottant", - "'%value%' does not appear to be a postal code" => "'%value%' ne semble pas être un code postal valide", - "'%value%' does not appear to be a valid IP address" => "'%value%' n'est pas une IP valide", - "'%value%' does not appear to be a valid date" => "'%value%' ne semble pas être une date valide", - "'%value%' does not appear to be a valid local network name" => "'%value%' ne semble pas être une adresse réseau local valide", - "'%value%' does not appear to be an integer" => "'%value%' n'est pas un entier", - "'%value%' does not fit the date format '%format%'" => "'%value%' ne correspond pas au format de date '%format%'", - "'%value%' does not match against pattern '%pattern%'" => "'%value%' n'a pas de correspondance avec le motif '%pattern%'", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' ne correspond pas à la structure d'un nom d'hôte DNS valide", - "'%value%' exceeds the allowed length" => "'%value%' excède la taille autorisée", - "'%value%' failed checksum validation" => "'%value%' ne passe pas la validation de somme de contrôle", - "'%value%' has a false IBAN format" => "'%value%' n'a pas un format IBAN valide", - "'%value%' has failed the IBAN check" => "'%value%' n'a pas passé la validation IBAN", - "'%value%' has not only hexadecimal digit characters" => "'%value%' ne contient pas uniquement des caractères héxadécimaux", - "'%value%' is an empty string" => "'%value%' est une chaîne vide", - "'%value%' is less than %min% characters long" => "La taille de '%value%' est inférieure à %min% caractères", - "'%value%' is more than %max% characters long" => "La taille de '%value%' est supérieure à %max% caractères", - "'%value%' is not a valid ISBN number" => "'%value%' n'est pas un ISBN valide", - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' n'est pas un email valide dans le format local-part@hostname", - "'%value%' is not a valid sitemap changefreq" => "'%value%' n'est pas une valeur de fréquence de sitemap valide", - "'%value%' is not a valid sitemap lastmod" => "'%value%' n'est pas une date de modification de sitemap valide", - "'%value%' is not a valid sitemap location" => "'%value%' n'est pas un emplacement valide pour une sitemap", - "'%value%' is not a valid sitemap priority" => "'%value%' n'est pas une priorité sitemap valide", - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' n'est pas comprise entre '%min%' et '%max%', inclusivement", - "'%value%' is not from an allowed institute" => "'%value%' ne provient pas d'une institution autorisée", - "'%value%' is not greater than '%min%'" => "'%value%' n'est pas plus grand que '%min%'", - "'%value%' is not less than '%max%'" => "'%value%' n'est pas plus petit que '%max%'", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' n'est pas strictement comprise entre '%min%' et '%max%'", - "'%value%' is not valid" => "'%value%' n'est pas valide", - "'%value%' must contain between 13 and 19 digits" => "'%value%' doit contenir entre 13 et 19 chiffres", - "'%value%' must contain only digits" => "'%value%' ne doit contenir que des chiffres", - "'%value%' seems to be an invalid creditcard number" => "'%value%' ne semble pas être une carte de crédit valide", - "'%value%' seems to contain an invalid checksum" => "'%value%' semble contenir un somme de vérification invalide", - "'%value%' should have a length of %length% characters" => "'%value%' devrait avoir une taille de %length% caractères", - "'%value%' was not found in the haystack" => "'%value%' ne fait pas partie des valeurs attendues", - "A PHP extension returned an error while uploading the file '%value%'" => "Une extension PHP a retourné une erreur lors de l'envoi du fichier '%value%'", - 'A crc32 hash could not be evaluated for the given file' => "La somme de contrôle crc32 n'a pas pu être évaluée pour le fichier", - 'A hash could not be evaluated for the given file' => "Une somme de contrôle n'a pas pu être calculée pour le fichier", - 'A md5 hash could not be evaluated for the given file' => "Une somme de contrôle MD5 n'a pas pu être calculée pour le fichier", - "A record matching '%value%' was found" => "Un enregistrement a été trouvé pour '%value%'", - 'A sha1 hash could not be evaluated for the given file' => "La valeur de somme de contrôle SHA-1 n'a pas pu être calculée pour le fichier", - 'An exception has been raised within the callback' => 'Une exception a été levée par la fonction de rappel', - "An exception has been raised while validating '%value%'" => "Une exception a été levée lors de la validation de '%value%'", - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Tous les fichiers devraient avoir une taille maximale de '%max%' mais une taille de '%size%' a été détectée", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Tous les fichiers devraient avoir une taille minimale de '%min%' mais une taille de '%size%' a été détectée", - "File '%value%' can't be written" => "Le fichier '%value%' ne peut être écrit", - "File '%value%' does not exist" => "Le fichier '%value%' n'existe pas", - "File '%value%' does not match the given crc32 hashes" => "Le fichier '%value%' ne correspond pas à la somme de contrôle crc32", - "File '%value%' does not match the given hashes" => "Le fichier '%value%' ne correspond pas à la somme de contrôle", - "File '%value%' does not match the given md5 hashes" => "Le fichier '%value%' ne correspond pas à la somme de contrôle MD5", - "File '%value%' does not match the given sha1 hashes" => "Le fichier '%value%' ne correspond pas à la somme de contrôle SHA-1", - "File '%value%' exceeds the defined form size" => "Le fichier '%value%' excède la taille requise par le formulaire", - "File '%value%' exceeds the defined ini size" => "Le fichier '%value%' excède la taille requise par le fichier ini", - "File '%value%' exists" => "Le fichier '%value%' existe déja", - "File '%value%' has a false extension" => "Le fichier '%value%' n'a pas la bonne extension", - "File '%value%' has a false mimetype of '%type%'" => "Le fichier '%value%' a un mauvais type MIME : '%type%'", - "File '%value%' is no image, '%type%' detected" => "Le fichier '%value%' n'est pas une image : '%type%' détecté", - "File '%value%' is not compressed, '%type%' detected" => "Le fichier '%value%' n'est pas compressé : '%type%' détecté", - "File '%value%' is not readable or does not exist" => "Le fichier '%value%' n'est pas lisible ou n'existe pas", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Fichier '%value%' mal envoyé. Ceci peut être possiblement une attaque", - "File '%value%' was not found" => "Fichier '%value%' introuvable", - "File '%value%' was not uploaded" => "Le fichier '%value%' n'a pas été envoyé", - "File '%value%' was only partially uploaded" => "Le fichier '%value%' n'a été que partiellement envoyé", - 'Invalid type given. Numeric string, integer or float expected' => 'Type invalide. Chaîne numérique, entier ou flottant attendu', - 'Invalid type given. String expected' => 'Type invalide. Chaîne attendue', - 'Invalid type given. String or integer expected' => 'Type invalide. Chaîne ou entier attendu', - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Type invalide. Chaîne, entier, tableau ou Zend_Date attendu', - 'Invalid type given. String, integer, float, boolean or array expected' => 'Type invalide. Chaîne, entier, flottant, booléen ou tableau attendu', - 'Invalid type given. String, integer or float expected' => 'Type invalide. Chaîne, entier ou flottant attendu', - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "L'algorithme Luhn (somme de contrôle mod-10) a échoué pour '%value%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "La hauteur maximale de l'image '%value%' devrait être '%maxheight%' mais '%height%' a été détectée", - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "La taille maximale requise pour le fichier '%value%' est de '%max%' mais '%size%' a été détecté", - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "La largeur maximale de l'image '%value%' devrait être '%maxwidth%' mais '%width%' a été détectée", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "La hauteur minimale de l'image '%value%' devrait être '%minheight%' mais '%height%' a été détectée", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "La taille minimale requise pour le fichier '%value%' est de '%min%' mais '%size%' a été détecté", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "La largeur minimale de l'image '%value%' devrait être '%minwidth%' mais '%width%' a été détectée", - "No record matching '%value%' was found" => "Aucun enregistrement trouvé pour '%value%'", - "No temporary directory was found for file '%value%'" => "Pas de dossier temporaire trouvé pour le fichier '%value%'", - 'No token was provided to match against' => "Aucun jeton de correspondance n'a été donné", - 'One or more files can not be read' => "Un ou plusieurs fichiers n'est pas lisible", - "The mimetype of file '%value%' could not be detected" => "Le type MIME du fichier '%value%' n'a pu être détecté", - "The size of image '%value%' could not be detected" => "La taille de l'image '%value%' n'a pas pu être détectée", - 'The two given tokens do not match' => 'Les deux jetons passés ne correspondent pas', - "There was an internal error while using the pattern '%pattern%'" => "Il y a eu une erreur interne lors de l'utilisation du motif '%pattern%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Trop peu de fichiers : un minimum de '%min%' est autorisé mais '%count%' ont été fournis", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Trop peu de mots, un minimum de '%min%' est requis, '%count%' ont été fournis", - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Trop de fichiers : un maximum de'%max%' est autorisé mais '%count%' ont été fournis", - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Trop de mots, un maximum de '%max%' est requis, '%count%' ont été fournis", - "Unknown country within the IBAN '%value%'" => "Pays inconnu pour l'IBAN '%value%'", - "Unknown error while uploading file '%value%'" => "Erreur inconnue lors de l'envoi du fichier '%value%'", - "Value is required and can't be empty" => 'Cette valeur est obligatoire et ne peut être vide', -]; diff --git a/resources/languages/hr/Zend_Validate.php b/resources/languages/hr/Zend_Validate.php deleted file mode 100644 index 116fe75ca..000000000 --- a/resources/languages/hr/Zend_Validate.php +++ /dev/null @@ -1,258 +0,0 @@ - 'Neispravan tip, vrijednost bi trebala biti niz slova, brojki ili realni broj', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' sadrži znakove koji nisu ni slova ni brojke", - "'%value%' is an empty string" => "'%value%' je prazan niz", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost mora biti niz slova', - "'%value%' contains non alphabetic characters" => "'%value%' sadrži znakove koji nisu slova", - "'%value%' is an empty string" => "'%value%' je prazan niz", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' nije prošao provjeru", - "'%value%' contains invalid characters" => "'%value%' sadrži neispravne znakove", - "'%value%' should have a length of %length% characters" => "'%value%' bi trebao imati dužinu od %length% znakova", - 'Invalid type given, value should be string' => 'Neispravan tip, vrijedno mora biti niz znakova', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' nije između '%min%' i '%max%', uključivo", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' nije strogo između '%min%' i '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' nije ispravan", - 'Failure within the callback, exception returned' => 'Pogreška sa povratnim pozivom, iznimka vraćena', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' mora sadržavati između 13 i 19 znamenki", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algoritam (mod-10 provjera) nije prošla na '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algoritam (mod-10 provjera) nije prošla na '%value%'", - "'%value%' must contain only digits" => "'%value%' mora sadržavati samo znamenke", - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost mora biti niz znakova', - "'%value%' contains an invalid amount of digits" => "'%value%' sadrži neispravan broj znamenki", - "'%value%' is not from an allowed institute" => "'%value%' nije iz dozvoljene institucije", - "Validation of '%value%' has been failed by the service" => "Servis nije odobrio provjeru '%value%'", - "The service returned a failure while validating '%value%'" => "Servis je vratio pogrešku provjeravajući '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'Neispravan tip, vrijednost mora biti niz znakova, broj, polje ili Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' ne izgleda kao ispravan datum", - "'%value%' does not fit the date format '%format%'" => "'%value%' ne odgovara formatu datuma '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Nije pronađen zapis koji se podudara sa %value%', - "A record matching '%value%' was found" => 'Zapis koji se podudara sa %value% je pronađen', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Neispravan tip, vrijednost bi trebala biti niz slova, brojki ili realni broj', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' sadrži znakove koji nisu znamenke; samo znamenke su dozvoljene", - "'%value%' is an empty string" => "'%value%' je prazan niz", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost bi trebala biti niz', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' nije ispravna email adresa u osnovnom formatu lokalni-dio@ime-poslužitelja", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' nije ispravno ime poslužitelja za email adresu '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' nema ispravan MX zapis za email adresu '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' nije u rutabilnom mrežnom segmentu. Email adresa '%value%' ne bi smjela biti razlučiva iz javne mreže.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' se ne podudara s dot-atom formatom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' se ne podudara s 'quoted-string' formatom", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' nije ispravan lokalni dio za email adresu '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' je duža od dozvoljene dužine", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Previše datoteka, maksimalno '%max%' je dozvoljeno, a '%count%' je zadano", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Premalo datoteka, minimalno '%min%' se očekuje a '%count%' je zadano", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Datoteka '%value%' se ne podudara sa zadanim crc32 hash-em", - 'A crc32 hash could not be evaluated for the given file' => 'crc32 hash se ne može izračunati za zadanu datoteku', - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Datoteka '%value%' ima neispravnu ekstenziju", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Datoteka '%value%' ima neispravan 'mime' tip '%type%'", - "The mimetype of file '%value%' could not be detected" => "'Mime' tip datoteke '%value%' nije moguće detektirati", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Datoteka '%value%' ne postoji", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Datoteka '%value%' ima neispravnu ekstenziju", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Sve datoteke zajedno mogu imati maksimalnu veličinu od '%max%', a imaju '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Sve datoteke zajedno moraju imati minimalnu veličinu od '%min%', a imaju '%size%'", - 'One or more files can not be read' => 'Jednu ili više datoteka nije moguće pročitati', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Datoteka '%value%' ne odgovara danom 'hashu'", - 'A hash could not be evaluated for the given file' => "'Hash' nije moguće izračunati za zadanu datoteku", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maksimalna dozvoljena širina slike '%value%' je '%maxwidth%', slika je široka '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimalna očekivana širina slike '%value%' je '%minwidth%' slika je široka '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maksimalna dozvoljena visina slike '%value%' je '%maxheight%', slika je visoka '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimalna očekivana visina slike '%value%' je '%minheight%', slika je visoka '%height%'", - "The size of image '%value%' could not be detected" => "Dimenzije slike '%value%' nije moguće otkriti", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Datoteka '%value%' nije kompresirana, datoteka je tipa '%type%'", - "The mimetype of file '%value%' could not be detected" => "'Mime' tip datoteke '%value%' nije moguće detektirati", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Datoteka '%value%' nije slika, datoteka je tipa '%type%'", - "The mimetype of file '%value%' could not be detected" => "'Mime' tip datoteke '%value%' nijem moguće detektirati", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Datoteka '%value%' ne odgovara zadanom md5 hash-u", - 'A md5 hash could not be evaluated for the given file' => 'Md5 hash nije moguće izračunati za zadanu datoteku', - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Datoteka '%value%' ima neispravan 'mime' tip '%type%'", - "The mimetype of file '%value%' could not be detected" => "'Mime' tip datoteke '%value%' nije moguće detektirati", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Datiteja '%value%' postoji", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Datoteka '%value%' ne odgovara zadanom sha1 hash-u", - 'A sha1 hash could not be evaluated for the given file' => 'Sha1 hash se ne može izračunati za zadanu datoteku', - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maksimalna dozvoljena veličina datoteka '%value%' je '%max%', datoteka je velika '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimalna dozvoljena veličina datoteke '%value%' je '%min%', datoteka je velika '%size%'", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Datoteka '%value%' prelazi veličinu definiranu u ini datoteci", - "File '%value%' exceeds the defined form size" => "Datoteka '%value%' prelazi veličinu definiranu u formi", - "File '%value%' was only partially uploaded" => "Datoteka '%value%' je samo djelomično poslana", - "File '%value%' was not uploaded" => "Datoteka '%value%' nije poslana", - "No temporary directory was found for file '%value%'" => "Nije pronađen privremeni direktorij za datoteku '%value%'", - "File '%value%' can't be written" => "Datoteku '%value%' nije moguće zapisati", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP ekstenzija je vratila pogrešku prilikom slanja datoteke '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Datoteka '%value%' je nelegalno poslana. Ovo bi mogao biti napad", - "File '%value%' was not found" => "Datoteka '%value%' nije pronađena", - "Unknown error while uploading file '%value%'" => "Nepoznata pogreška prilikom slanja datoteke '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Previše riječi, maksimalno '%max%' riječi je dozvoljeno, a ima ih '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Premalo riječi, očekuje se minimalno '%min%' riječi, a ima ih '%count%' ", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Neispravan tip, vrijednost bi trebala biti niz slova, brojki ili realni broj', - "'%value%' does not appear to be a float" => "'%value%' nije realni broj", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' nije veće od '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost bi trebala biti niz', - "'%value%' has not only hexadecimal digit characters" => "'%value%' nema samo heksadekadske znamenke", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Neispravan tup, vrijednost bi trebala biti niz', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' izgleda kao IP adresa, IP adrese nisu dozvoljene", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' izgleda kao DNS ime poslužitelja, ali ne mogu pronaći vršnu domenu u listi poznatih", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' izgleda kao DNS ime poslužitelja, ali ima crtu ne neispravnoj poziciji", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' izgleda kao DNS ime poslužitelja ali se ne podudara sa shemom imena poslužitelja za vršnu domenu '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' izgleda kao DNS ime poslužitelja, ali ne mogu izvući dio koji označava vršnu domenu", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' se ne podudara sa očekivanom strukturom DNS imena poslužitelja", - "'%value%' does not appear to be a valid local network name" => "'%value%' ne izgleda kao ispravno ime lokalne mreže", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' izgleda kao ime lokalne mreže, ali imena lokalnih mreža nisu dozvoljena", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' izgleda kao DNS ime poslužitelja ali zadanu 'punycode' notaciju nije moguće dekodirati", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Nepoznata zemlja unutar IBAN-a '%value%'", - "'%value%' has a false IBAN format" => "'%value%' ima neispravan IBAN format", - "'%value%' has failed the IBAN check" => "'%value%' nije prošlo IBAN provjeru", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Zadane vrijednosti se ne podudaraju', - 'No token was provided to match against' => 'Nije zadano vrijednost s kojom se treba usporediti', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "Vrijednost '%value%' nije pronađena u polju", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Neispravan tip, vrijednost bi trebala biti niz ili cijeli broj', - "'%value%' does not appear to be an integer" => "'%value%' ne izgleda kao cijeli broj", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - "'%value%' does not appear to be a valid IP address" => "'%value%' ne izgleda kao ispravna IP adresa", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'Neispravan tip, vrijednost mora biti niz ili cijeli broj', - "'%value%' is not a valid ISBN number" => "'%value%' nije ispravan ISBN broj", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' nije manje od '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => "Neispravan tip, vrijednost mora biti realni broj, niz, polje, cijeli broj ili 'boolean'", - "Value is required and can't be empty" => 'Vrijednost ne smije biti prazna', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'Neispravan tip. Vrijednost mora biti niz ili cijeli broj', - "'%value%' does not appear to be a postal code" => "'%value%' ne izgleda kao poštanski kod", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Neispravan tip, vrijednost mora biti niz, cijeli ili realni broj', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' se ne podudara sa uzorkom '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Došlo je do interne pogreške prilikom korištenja uzorka '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' nije ispravna vrijednost za sitemap 'changefreq'", - 'Invalid type given, the value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' nije ispravna vrijednost za sitemap 'lastmod'", - 'Invalid type given, the value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' nije ispravna lokacija za 'sitemap'", - 'Invalid type given, the value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' nije ispravna vrijednost za sitemap 'priority'", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'Neispravan tip, vrijednost mora biti cijeli broj, realni broj ili niz znamenki', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - "'%value%' is less than %min% characters long" => "'%value%' ima manje od %min% znaka", - "'%value%' is more than %max% characters long" => "'%value%' ima više od %max% znakova", -]; diff --git a/resources/languages/it/Zend_Validate.php b/resources/languages/it/Zend_Validate.php deleted file mode 100644 index 218442e46..000000000 --- a/resources/languages/it/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - "Tipo di dato non valido: il dato dev'essere di tipo float, stringa o intero.", - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contine caratteri che non sono alfanumerici", - "'%value%' is an empty string" => "'%value%' è una stringa vuota", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' contains non alphabetic characters" => "'%value%' contiene caratteri non alfabetici", - "'%value%' is an empty string" => "'%value%' è una stringa vuota", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' non ha un checksum valido", - "'%value%' contains invalid characters" => "'%value%' contiene caratteri non permessi", - "'%value%' should have a length of %length% characters" => "'%value%' non ha la lunghezza corretta di %length% caratteri", - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' non è compreso tra '%min%' e '%max%', inclusi", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' non è strettamente compreso tra '%min%' e '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' non è valido", - 'Failure within the callback, exception returned' => 'Callback fallita, eccezione ritornata', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' deve contenere tra 13 e 19 cifre", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "L'algoritmo di Luhn (checksum mod-10) è fallito su '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "L'algoritmo di Luhn (checksum mod-10) è fallito su '%value%'", - "'%value%' must contain only digits" => "'%value%' deve contenere solo cifre", - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' contains an invalid amount of digits" => "'%value%' contiene un numero non valido di cifre", - "'%value%' is not from an allowed institute" => "'%value%' proviene da un istituto non supportato", - "Validation of '%value%' has been failed by the service" => "'%value%' non è stato validato dal servizio", - "The service returned a failure while validating '%value%'" => "Il servizio ha ritornato validazione negativa per '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => "Tipo di dato non valido, il dato dev'essere di tipo stringa, intero, array o Zend_Date", - "'%value%' does not appear to be a valid date" => "'%value%' non sembra essere una data valida", - "'%value%' does not fit the date format '%format%'" => "'%value%' non corrisponde al formato data '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Non è stato trovato una riga con valore %value%', - "A record matching '%value%' was found" => "E' già stata trovata una riga con valore %value%", - - // Zend_Validate_Digits - 'Invalid type given, value should be float, string, or integer' => "Tipo di dato non valido: il dato dev'essere di tipo float, stringa o intero.", - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' contiene caratteri che non sono cifre, ma solo le cifre sono ammesse", - "'%value%' is an empty string" => "'%value%' è una stringa vuota", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' non è un indirizzo email valido nel formato base local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' non è un hostname valido nell'indirizzo email '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' non sembra avere un record MX DNS valido nell'indirizzo email %value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' non è in un segmento di rete routabile. L'indirizzo email '%value%' non può essere risolto nella rete pubblica.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' non può essere validato nel formato dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' non può essere validato nel formato quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' non è una local part valida nell'indirizzo email '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' supera la lunghezza consentita", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Troppi file, sono consentiti massimo '%max%' file ma ne sono stati passati '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Troppi pochi file, sono attesi minimo '%min%' file ma ne sono stato passati solo '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Il file '%value%' non ha un hash crc32 tra quelli consentiti", - 'A crc32 hash could not be evaluated for the given file' => "L'hash crc32 non può essere calcolato per il file dato", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Il file '%value%' ha un'estensione invalida", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => " Il file '%value%' ha un mimetype non consentito: '%type%'", - "The mimetype of file '%value%' could not be detected" => "Il mimetype del file '%value%' non può essere individuato", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Il file '%value%' non esiste", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Il file '%value%' ha un'estensione invalida", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "I file devono avere in totale una dimensione massima di '%max%' ma è stata rilevata una dimensione di '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "I file devono avere in totale una dimensione minima di '%min%' ma è stata rilevata una dimensione di '%size%'", - 'One or more files can not be read' => 'Uno o più file non possono essere letti', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "I file '%value%' non corrisponde agli hash dati", - 'A hash could not be evaluated for the given file' => 'Un hash non può essere valutato per il file dato', - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "La larghezza massima consentita per l'immagine '%value%' è '%maxwidth%' ma è stata rilevata una larghezza di '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "La larghezza minima consentita per l'immagine '%value%' è '%minwidth%' ma è stata rilevata una larghezza di '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "L'altezza massima consentita per l'immagine '%value%' è '%maxheight%' ma è stata rilevata un'altezza di '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "L'altezza minima consentita per l'immagine '%value%' è '%minheight%' ma è stata rilevata un'altezza di '%height%'", - "The size of image '%value%' could not be detected" => "Le dimensioni dell'immagine '%value%' non possono essere rilevate", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Il file '%value%' non è un file compresso, ma un file di tipo '%type%'", - "The mimetype of file '%value%' could not be detected" => "Il mimetype del file '%value%' non può essere rilevato", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Il file '%value%' non è un'immagine, ma un file di tipo '%type%'", - "The mimetype of file '%value%' could not be detected" => "Il mimetype del file '%value%' non può essere rilevato", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Il file '%value%' non corrisponde agli hash md5 dati", - 'A md5 hash could not be evaluated for the given file' => 'Un hash md5 non può essere valutato per il file dato', - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Il file '%value%' ha un mimetype invalido: '%type%'", - "The mimetype of file '%value%' could not be detected" => "Il mimetype del file '%value%' non può essere rilevato", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Il file '%value%' esiste già", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Il file '%value%' non corrisponde agli hash sha1 dati", - 'A sha1 hash could not be evaluated for the given file' => 'Un hash sha1 non può essere valutato per il file dato', - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "La dimensione massima consentita per il file '%value%' è '%max%' ma è stata rilevata una dimensione di '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "La dimensione minima consentita per il file '%value%' è '%min%' ma è stata rilevata una dimensione di '%size%'", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Il file '%value%' eccede la dimensione definita nell'ini", - "File '%value%' exceeds the defined form size" => "Il file '%value%' eccede la dimensione definita nella form", - "File '%value%' was only partially uploaded" => "Il file '%value%' è stato caricato solo parzialmente", - "File '%value%' was not uploaded" => "Il file '%value%' non è stato caricato", - "No temporary directory was found for file '%value%'" => "Non è stata trovata una directory temporanea per il file '%value%'", - "File '%value%' can't be written" => "Il file '%value%' non può essere scritto", - "A PHP extension returned an error while uploading the file '%value%'" => "Un'estensione di PHP ha generato un errore durante il caricamento del file '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Il file '%value%' è stato caricato irregolarmente. Potrebbe trattarsi di un attacco", - "File '%value%' was not found" => "Il file '%value%' non è stato trovato", - "Unknown error while uploading file '%value%'" => "Errore sconosciuto durante il caricamento del file '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Il file contiene troppe parole, ne sono consentite massimo '%max%' ma ne sono state contate '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Il file contiene troppe poche parole, ne sono consentite minimo '%min%' ma ne sono state contate '%count%'", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => "Tipo di dato non valido: il dato dev'essere di tipo float, stringa o intero.", - "'%value%' does not appear to be a float" => "'%value%' non sembra essere un dato di tipo float", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' non è maggiore di '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' has not only hexadecimal digit characters" => "'%value%' non è composto solo da caratteri esadecimali", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' sembra essere un indirizzo IP, ma gli indirizzi IP non sono consentiti", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' sembra essere un hostname DNS ma il suo TLD è sconosciuto", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' sembra essere un hostname DNS ma contiene un trattino in una posizione non valida", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' sembra essere un hostname DNS ma non rispetta lo schema per il TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' sembra essere un hostname DNS ma non è possibile estrarne il TLD", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' non sembra rispettare la struttura attesa per un hostname DNS", - "'%value%' does not appear to be a valid local network name" => "'%value%' non sembra essere un local network name valido", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' sembra essere un local network name, ma i local network names non sono consentiti", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' sembra essere un hostname DNS ma la notazione punycode data non può essere decodificata", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Country Code sconosciuto nell'IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' ha un formato IBAN non valido", - "'%value%' has failed the IBAN check" => "'%value%' ha fallito il controllo IBAN", - - // Zend_Validate_Identical - "The token '%token%' does not match the given token '%value%'" => "Il token '%token%' non corrisponde al token dato '%value%'", - 'No token was provided to match against' => 'Non è stato dato nessun token per il confronto', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' non è stato trovato nell'array", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => "Tipo di dato non valido, il dato dev'essere una stringa o un intero", - "'%value%' does not appear to be an integer" => "'%value%' non sembra essere un intero", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' does not appear to be a valid IP address" => "'%value%' non sembra essere un indirizzo IP valido", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => "Tipo di dato non valido, il dato dev'essere una stringa o un intero", - "'%value%' is not a valid ISBN number" => "'%value%' non è un numero ISBN valido", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' non è minore di '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => "Tipo di dato non valido, il dato dev'essere di tipo float, stringa, array, booleano o intero", - "Value is required and can't be empty" => 'Il dato è richiesto e non può essere vuoto', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => "Tipo di dato non valido. Il dato dev'essere una stringa o un intero", - "'%value%' does not appear to be a postal code" => "'%value%' non sembra essere un codice postale", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => "Tipo di dato non valido: il dato dev'essere di tipo stringa, intero o float.", - "'%value%' does not match against pattern '%pattern%'" => "'%value%' non corrisponde al pattern '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Si è verificato un errore interno usando il pattern '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' non è una sitemap changefreq valida", - 'Invalid type given, the value should be a string' => 'Invalid type given, the value should be a string', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' non è un sitemap lastmod valido", - 'Invalid type given, the value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' non è una sitemap location valida", - 'Invalid type given, the value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' non è una sitemap priority valida", - 'Invalid type given, the value should be a integer, a float or a numeric string' => "Tipo di dato non valido, il dato dev'essere di tipo intero, float o una stringa numerica", - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' is less than %min% characters long" => "'%value%' è meno lungo di %min% caratteri", - "'%value%' is more than %max% characters long" => "'%value%' è più lungo di %max% caratteri", -]; diff --git a/resources/languages/ja/Zend_Validate.php b/resources/languages/ja/Zend_Validate.php deleted file mode 100644 index 62b529d53..000000000 --- a/resources/languages/ja/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - '不正な形式です。文字列、整数もしくは小数が期待されています', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' にアルファベットと数字以外の文字が含まれています", - "'%value%' is an empty string" => "'%value%' は空の文字列です", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' contains non alphabetic characters" => "'%value%' にアルファベット以外の文字が含まれています", - "'%value%' is an empty string" => "'%value%' は空の文字列です", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' はチェックサムが一致していません", - "'%value%' contains invalid characters" => "'%value%' は不正な文字を含んでいます", - "'%value%' should have a length of %length% characters" => "'%value%' は %length% 文字である必要があります", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' は '%min%' 以上 '%max%' 以下ではありません", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' は '%min%' 以下か '%max%' 以上です", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' は正しくありません", - 'An exception has been raised within the callback' => 'コールバック内で例外が発生しました', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' は 13 桁から 19 桁の数字でなければなりません", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "'%value%' でルーンアルゴリズム(mod-10 チェックサム)に失敗しました", - - // Zend_Validate_CreditCard - "%value%' seems to contain an invalid checksum" => "'%value%' は不正なチェックサムを含んでいるようです", - "'%value%' must contain only digits" => "'%value%' は数値だけで構成される必要があります", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' contains an invalid amount of digits" => "'%value%' は不正な桁数です", - "'%value%' is not from an allowed institute" => "'%value%' は認可機関から許可されていません", - "%value%' seems to be an invalid creditcard number" => "'%value%' は不正なクレジットカード番号を含んでいるようです", - "An exception has been raised while validating '%value%" => "'%value%' を検証中に例外が発生しました", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => '不正な形式です。値は文字列、整数、配列もしくは Zend_Date 形式である必要があります', - "'%value%' does not appear to be a valid date" => "'%value%' は正しい日付ではないようです", - "'%value%' does not fit the date format '%format%'" => "'%value%' は '%format%' フォーマットに一致していません", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => " '%value%' に一致するレコードは見つかりませんでした", - "A record matching '%value%' was found" => " '%value%' に一致するレコードが見つかりました", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => '不正な形式です。文字列、整数または小数が期待されています', - "%value%' must contain only digits" => "'%value%' は数字のみである必要があります", - "'%value%' is an empty string" => "'%value%' は空の文字列です", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' is no valid email address in the basic format local-part@hostname" => "'%value%' はメールアドレスの基本的な形式 local-part@hostname ではありません", - "'%hostname%' is not a valid hostname for email address '%value%'" => "メールアドレス '%value%' 内の '%hostname%' は有効なホスト名ではありません", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "メールアドレス '%value%' 内の '%hostname%' は有効な MX レコードではないようです", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' はネットワークセグメントにありません。メールアドレス '%value%' はパブリックなネットワークから名前解決できませんでした", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' はドットアトム形式ではありません", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' は引用文字列形式ではありません", - "'%localPart%' is no valid local part for email address '%value%'" => "メールアドレス '%value%' 内の '%localPart%' は有効なローカルパートではありません", - "'%value%' exceeds the allowed length" => "'%value%' は許された長さを超えています", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "ファイル数が多すぎます。最大 '%max%' まで許されていますが、 '%count%' 個指定しました", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "ファイル数が少なすぎます。最小 '%min%' 以上の必要がありますが、 '%count%' 個指定されていません", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "ファイル '%value%' は crc32 ハッシュ値と一致しませんでした", - 'A crc32 hash could not be evaluated for the given file' => 'ファイルに crc32 ハッシュ値が見つかりませんでした', - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "ファイル '%value%' は誤った拡張子です", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "ファイル '%value%' は誤った mimetype '%type%' です", - "The mimetype of file '%value%' could not be detected" => "ファイル '%value%' の mimetype が見つかりませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "ファイル '%value%' は存在しません", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "ファイル '%value%' は誤った拡張子です", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "全てのファイルの合計は最大 '%max%' より小さい必要があります。しかしファイルサイズは '%size%' でした", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "全てのファイルの合計は最小 '%min%' より大きい必要があります。しかしファイルサイズは '%size%' でした", - 'One or more files can not be read' => 'ファイルを読み込めませんでした', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "ファイル '%value%' は設定されたハッシュ値と一致しませんでした", - 'A hash could not be evaluated for the given file' => '渡されたファイルのハッシュ値を評価できませんでした', - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "画像 '%value%' の横幅は '%width%' でした。横幅は最大 '%maxwidth%' まで許されています", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "画像 '%value%' の横幅は '%width%' でした。横幅は最小 '%minwidth%' 以上である必要があります", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "画像 '%value%' の高さは '%height%' でした。高さは最大 '%maxheight%' まで許されています", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "画像 '%value%' の高さは '%height%' でした。高さは最小 '%minheight%' 以上である必要があります", - "The size of image '%value%' could not be detected" => "画像 '%value%' の大きさを取得できませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => " '%type%' が見つかりました。ファイル '%value%' は圧縮されていません", - "The mimetype of file '%value%' could not be detected" => "ファイル '%value%' の Mimetype は見つかりませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "ファイル '%value%' は画像ではありません。 '%type%' です", - "The mimetype of file '%value%' could not be detected" => "ファイル '%value%' の Mimetype は見つかりませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "ファイル '%value%' は md5 ハッシュ値と一致していません", - 'A md5 hash could not be evaluated for the given file' => '渡されたファイルの md5 ハッシュ値を評価できませんでした', - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "ファイル '%value%' は誤った MimeType '%type%' です", - "The mimetype of file '%value%' could not be detected" => "ファイル '%value%' の Mimetype は見つかりませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "ファイル '%value%' は存在しています", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "ファイル '%value%' は sha1 ハッシュ値と一致していません", - 'A sha1 hash could not be evaluated for the given file' => '渡されたファイルの sha1 ハッシュ値を評価できませんでした', - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "ファイルサイズは '%size%' です。ファイル '%value%' のサイズは最大 '%max%' まで許されています", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "ファイルサイズは '%size%' です。ファイル '%value%' のサイズは最小 '%min%' 以上必要です", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "ファイル '%value%' は ini で定義されたサイズを超えています", - "File '%value%' exceeds the defined form size" => "ファイル '%value%' はフォームで定義されたサイズを超えています", - "File '%value%' was only partially uploaded" => "ファイル '%value%' は一部のみしかアップロードされていません", - "File '%value%' was not uploaded" => "ファイル '%value%' はアップロードされませんでした", - "No temporary directory was found for file '%value%'" => "ファイル '%value%' をアップロードする一時ディレクトリが見つかりませんでした", - "File '%value%' can't be written" => "ファイル '%value%' は書き込めませんでした", - "A PHP extension returned an error while uploading the file '%value%'" => "ファイル '%value%' をアップロード中に拡張モジュールがエラーを応答しました", - "File '%value%' was illegally uploaded. This could be a possible attack" => "ファイル '%value%' は不正なアップロードでした。攻撃の可能性があります", - "File '%value%' was not found" => "ファイル '%value%' は見つかりませんでした", - "Unknown error while uploading file '%value%'" => "ファイル '%value%' をアップロード中に未知のエラーが発生しました", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "単語数 '%count%' が多過ぎます。最大で '%max%' 個が許されます", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "単語数 '%count%' が少な過ぎます。少なくとも '%min%' 個必要です", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => '不正な形式です。文字列、整数もしくは小数が期待されています', - "'%value%' does not appear to be a float" => " '%value%' は小数ではないようです", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => " '%value%' は '%min%' より大きくありません", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' has not only hexadecimal digit characters" => " '%value%' は 16 進文字列以外を含んでいます", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => " '%value%' は IP アドレスのようですが、 IP アドレスは許されていません", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => " '%value%' は DNS ホスト名のようですが、 TLD が一覧に見つかりません", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => " '%value%' は DNS ホスト名のようですが不正な位置にダッシュがあります", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => " '%value%' は DNS ホスト名のようですが TLD '%tld%' のホスト名スキーマと一致していません", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => " '%value%' は DNS ホスト名のようですが TLD 部を展開できません", - "'%value%' does not match the expected structure for a DNS hostname" => " '%value%' は DNS ホスト名の構造に一致していません", - "'%value%' does not appear to be a valid local network name" => " '%value%' は有効なローカルネットワーク名ではないようです", - "'%value%' appears to be a local network name but local network names are not allowed" => " '%value%' はローカルネットワーク名のようですがローカルネットワーク名は許されていません", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => " '%value%' は DNS ホスト名のようですが、 punycode 変換ができませんでした", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "IBAN コード '%value%' に未知の国があります", - "'%value%' has a false IBAN format" => " '%value%' は誤った IBAN 書式です", - "'%value%' has failed the IBAN check" => " '%value%' は IBAN コードチェックに失敗しました", - - // Zend_Validate_Identical - 'The two given tokens do not match' => '2 つのトークンは一致しませんでした', - 'No token was provided to match against' => 'チェックを行うためのトークンがありませんでした', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => " '%value%' が haystack の中に見つかりませんでした", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => '不正な形式です。文字列または整数が期待されています', - "'%value%' does not appear to be an integer" => " '%value%' は整数ではないようです", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' does not appear to be a valid IP address" => " '%value%' は IP アドレスではないようです", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => '不正な形式です。文字列または整数が期待されています', - "'%value%' is no valid ISBN number" => " '%value%' は ISBN 番号ではありません", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => " '%value%' は '%max%' 未満ではありません", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => '不正な形式です。文字列、整数、小数、真偽値もしくは配列が期待されています', - "Value is required and can't be empty" => '値は必須です。空値は許可されていません', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => '不正な形式です。文字列もしくは整数が期待されています', - "'%value%' does not appear to be a postal code" => " '%value%' は郵便番号でないようです", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => '不正な形式です。文字列、整数、もしくは小数が期待されています', - "'%value%' does not match against pattern '%pattern%'" => " '%value%' はパターン '%pattern%' と一致していません", - "There was an internal error while using the pattern '%pattern%'" => "正規表現パターン '%pattern%' を使用中に内部エラーが発生しました。", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is no valid sitemap changefreq" => " '%value%' は正しいサイトマップの更新頻度ではありません", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is no valid sitemap lastmod" => " '%value%' は正しいサイトマップの最終更新日ではありません", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - - // Zend_Validate_Sitemap_Loc - "'%value%' is no valid sitemap location" => " '%value%' は正しいサイトマップの位置ではありません", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - - // Zend_Validate_Sitemap_Priority - "'%value%' is no valid sitemap priority" => " '%value%' は正しいサイトマップの優先度ではありません", - 'Invalid type given. Numeric string, integer or float expected' => '不正な形式です。数字、整数もしくは小数が期待されています', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' is less than %min% characters long" => " '%value%' は %min% 文字より短いです", - "'%value%' is more than %max% characters long" => " '%value%' は %max% 文字より長いです", -]; diff --git a/resources/languages/nl/Zend_Validate.php b/resources/languages/nl/Zend_Validate.php deleted file mode 100644 index 52d5adbc5..000000000 --- a/resources/languages/nl/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Ongeldig type opgegeven, waarde moet een float, string of integer zijn', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' bevat tekens welke alfabetisch, noch numeriek zijn", - "'%value%' is an empty string" => "'%value%' is een lege string", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Ongeldig type opgegeven, waarde moet een string zijn', - "'%value%' contains non alphabetic characters" => "'%value%' bevat tekens welke niet alfabetisch zijn", - "'%value%' is an empty string" => "'%value%' is een lege string", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' slaagde niet in de checksum validatie", - "'%value%' contains invalid characters" => "'%value%' bevat ongeldige tekens", - "'%value%' should have a length of %length% characters" => "'%value%' moet een lengte hebben van %length% tekens", - 'Invalid type given, value should be string' => 'Ongeldig type opgegeven, waarde moet een string zijn', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' is niet tussen of gelijk aan '%min%' en '%max%'", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' is niet tussen '%min%' en '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' is ongeldig", - 'Failure within the callback, exception returned' => 'Fout opgetreden in de callback, exceptie teruggegeven', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' moet 13 tot 19 cijfers bevatten", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Het Luhn algoritme (mod-10 checksum) is niet gelukt op '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Het Luhn algoritme (mod-10 checksum) is niet geslaagd op '%value%'", - "'%value%' must contain only digits" => "'%value%' kan alleen cijfers bevatten", - 'Invalid type given, value should be a string' => 'Ongeldig type opgegeven, waarde moet een string zijn', - "'%value%' contains an invalid amount of digits" => "'%value%' bevat een ongeldige hoeveelheid cijfers", - "'%value%' is not from an allowed institute" => "'%value%' is niet afkomstig van een toegestaan instituut", - "Validation of '%value%' has been failed by the service" => "Validatie door de service van '%value%' is mislukt", - "The service returned a failure while validating '%value%'" => "De service heeft een foutmelding teruggegeven bij het valideren van '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'Ongeldig type opgegeven, waarde moet een string, integer, array of Zend_Date zijn', - "'%value%' does not appear to be a valid date" => "'%value%' lijkt geen geldige datum te zijn", - "'%value%' does not fit the date format '%format%'" => "'%value%' past niet in het datumformaat '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Er kon geen record gevonden wat overeenkomt met %value%', - "A record matching '%value%' was found" => 'Een record wat overeenkomt met %value% is gevonden', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Ongeldig type opgegeven, waarde moet een string, integer of float zijn', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' bevat niet enkel numerieke karakters", - "'%value%' is an empty string" => "'%value%' is een lege string", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Ongeldig type opgegeven, waarde moet een string zijn', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' is geen geldig e-mail adres in het basis formaat lokaal-gedeelte@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' is geen geldige hostnaam voor e-mail adres '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' lijkt geen geldig MX record te hebben voor e-mail adres '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' bevindt zich niet in een routeerbaar netwerk segment. Het e-mail adres '%value%' zou niet naar mogen worden verwezen vanaf een publiek netwerk.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' kan niet worden gematched met het dot-atom formaat", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' kan niet worden gematched met het quoted-string formaat", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' is geen geldig lokaal gedeelte voor e-mail adres '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' overschrijdt de toegestane lengte", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Te veel bestanden, maximaal '%max%' zijn toegestaan, maar '%count%' werd opgegeven", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Te weinig bestanden, er worden er minimaal '%min%' verwacht, maar er waren er '%count%' opgegeven", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "File '%value%' matcht niet met de opgegeven crc32 hashes", - 'A crc32 hash could not be evaluated for the given file' => 'Fout tijdens het genereren van een crc32 hash van het opgegeven bestand', - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Het bestand '%value%' heeft een ongeldige extensie", - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Het bestand '%value%' heeft een ongeldig mimetype: '%type%'", - "The mimetype of file '%value%' could not be detected" => "Het mimetype van bestand '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Het bestand '%value%' kon niet worden gelezen", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Bestand '%value%' bestaat niet", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Het bestand '%value%' heeft een ongeldige extensie", - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Alle bestanden tesamen hebben een maximale grootte van '%max%' maar '%size%' was gedetecteerd", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Alle bestanden tesamen hebben een minimum grotte van '%min%' maar '%size%' was gedetecteerd", - 'One or more files can not be read' => 'Eén of meer bestanden konden niet worden gelezen', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Het bestand '%value%' matcht niet met de opgegeven hashes", - 'A hash could not be evaluated for the given file' => 'Een hash kon niet worden gegenereerd voor het opgegeven bestand', - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maximum breedte voor afbeelding '%value%' is '%maxwidth%' maar '%width%' werd gedetecteerd", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimum breedte voor afbeelding '%value%' is '%minwidth%' maar '%width%' werd gedetecteerd", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maximum hoogte voor afbeelding '%value%' is '%maxheight%' maar '%height%' werd gedetecteerd", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimum hoogte voor afbeelding '%value%' is '%minheight%' maar '%height%' werd gedetecteerd", - "The size of image '%value%' could not be detected" => "De grootte van afbeelding '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Het bestand '%value%' kan niet worden gelezen", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Het bestand '%value%' is niet gecomprimeerd, '%type%' gedetecteerd", - "The mimetype of file '%value%' could not be detected" => "Het mimetype van bestand '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Bestand '%value%' kan niet worden gelezen", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Het bestand '%value%' is geen afbeelding, '%type%' gedetecteerd", - "The mimetype of file '%value%' could not be detected" => "Het mimetype van bestand '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Het bestand '%value%' kon niet worden gelezen", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Het bestand '%value%' matcht niet met de opgegeven md5-hashes", - 'A md5 hash could not be evaluated for the given file' => 'Een md5-hash kon niet gegenereerd worden voor het opgegeven bestand', - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Het bestand '%value%' heeft een ongeldig mimetype: '%type%'", - "The mimetype of file '%value%' could not be detected" => "Het mimetype van bestand '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Het bestand '%value%' kon niet worden gelezen", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Het bestand '%value%' bestaat", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Het bestand '%value%' matcht niet met de opgegeven sha1-hashes", - 'A sha1 hash could not be evaluated for the given file' => 'Een sha1-hash kon niet worden gegenereerd voor het opgegeven bestand', - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maximum grootte voor bestand '%value%' is '%max%' maar '%size%' werd gedetecteerd", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimum grootte voor bestand '%value%' is '%min%' maar '%size%' werd gedetecteerd", - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Het bestand '%value%' overschrijdt de ini grootte", - "File '%value%' exceeds the defined form size" => "Het bestand '%value%' overschrijdt de formulier grootte", - "File '%value%' was only partially uploaded" => "Het bestand '%value%' was slechts gedeeltelijk geüpload", - "File '%value%' was not uploaded" => "Het bestand '%value%' was niet geüpload", - "No temporary directory was found for file '%value%'" => "Geen tijdelijke map was gevonden voor bestand '%value%'", - "File '%value%' can't be written" => "Het bestand '%value%' kan niet worden geschreven", - "A PHP extension returned an error while uploading the file '%value%'" => "Een PHP-extensie gaf een foutmelding terug tijdens het uploaden van het bestand '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Het bestand '%value%' was illegaal geüpload. Dit kan een aanval zijn", - "File '%value%' was not found" => "Het bestand '%value%' kon niet worden gevonden", - "Unknown error while uploading file '%value%'" => "Er is een onbekende fout opgetreden tijdens het uploaden van '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Te veel woorden, er is een maximum van '%max%', maar er waren '%count%' geteld", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Te weinig worden, er is een minimum van '%min%' maar er waren '%count%' geteld", - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Ongeldig type opgegeven, waarde moet een float, string, of integer zijn', - "'%value%' does not appear to be a float" => "'%value%' lijkt geen float te zijn", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' is niet groter dan '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Ongeldig type gegeven, waarde moet een string zijn', - "'%value%' has not only hexadecimal digit characters" => "'%value%' bestaat niet enkel uit acht hexadecimale cijfers", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Ongeldig type gegeven, waarde moet een string zijn', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' lijkt een IP adres te zijn, maar IP adressen zijn niet toegestaan", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' lijkt een DNS hostnaam te zijn, maar het TLD bestaat niet in de lijst met bekende TLD's", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' lijkt een DNS hostnaam te zijn, maar bevat een streep op een ongeldige plek", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' lijkt een DNS hostnaam te zijn, maar past niet in het hostnaam-schema voor TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' lijkt een DNS hostnaam te zijn, maar kan niet het TLD gedeelte bepalen", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' matcht niet met de verwachte structuur voor een DNS hostnaam", - "'%value%' does not appear to be a valid local network name" => "'%value%' lijkt geen geldige lokale netwerknaam te zijn", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' lijkt een lokale netwerknaam te zijn, welke niet zijn toegestaan", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' lijkt een geldige DNS hostnaam te zijn, maar de opgegeven punnycode notatie kan niet worden gedecodeerd", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Onbekend land in de IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' heeft een ongeldig IBAN formaat", - "'%value%' has failed the IBAN check" => "'%value%' is geen geldige IBAN", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'De twee tokens komen niet overeen', - 'No token was provided to match against' => 'Er is geen token opgegeven om mee te matchen', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' kon niet worden gevonden in lijst met beschikbare waardes", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Ongeldig type opgegeven, waarde moet een string of integer zijn', - "'%value%' does not appear to be an integer" => "'%value%' lijkt geen integer te zijn", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Ongeldig type gegeven, waarde moet een string zijn', - "'%value%' does not appear to be a valid IP address" => "'%value%' lijkt geen geldig IP adres te zijn", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'Ongeldig type opgegeven, waarde moet een string of integer zijn', - "'%value%' is not a valid ISBN number" => "'%value%' is geen geldig ISBN nummer", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' is niet minder dan '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'Ongeldig type opgegeven, waarde dient een float, string, array, boolean of integer te zijn', - "Value is required and can't be empty" => 'Waarde is vereist en kan niet leeg worden gelaten', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'Ongeldig type opgegeven, waarde moet een string of integer zijn', - "'%value%' does not appear to be a postal code" => "'%value%' lijkt geen geldige postcode te zijn", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Ongeldig type opgegeven, waarde dient een string, integer of float te zijn', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' matcht niet met het patroon '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Er is een interne fout opgetreden tijdens het gebruik van het patroon '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' is geen geldige sitemap changefreq", - 'Invalid type given, the value should be a string' => 'Ongeldig type opgegeven, waarde dient een string te zijn', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' is geen geldige sitemap lastmod", - 'Invalid type given, the value should be a string' => 'Ongeldig type opgegeven, waarde dient een string te zijn', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' is geen geldige sitemap locatie", - 'Invalid type given, the value should be a string' => 'Ongeldig type opgegeven, waarde dient een string te zijn', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' is geen geldige sitemap prioriteit", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'Ongeldig type opgegeven, waarde dient een integer, float of een numerieke string te zijn', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Ongeldig type opgegeven, waarde dient een string te zijn', - "'%value%' is less than %min% characters long" => "'%value%' is minder dan %min% tekens lang", - "'%value%' is more than %max% characters long" => "'%value%' is meer dan %max% tekens lang", -]; diff --git a/resources/languages/pt_BR/Zend_Validate.php b/resources/languages/pt_BR/Zend_Validate.php deleted file mode 100644 index 315f8ea0f..000000000 --- a/resources/languages/pt_BR/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'O tipo especificado é inválido, o valor deve ser float, string, ou inteiro', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contém caracteres que não são alfabéticos e nem dígitos", - "'%value%' is an empty string" => "'%value%' é uma string vazia", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' contains non alphabetic characters" => "'%value%' contém caracteres não alfabéticos", - "'%value%' is an empty string" => "'%value%' é uma string vazia", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' falhou na validação do checksum", - "'%value%' contains invalid characters" => "'%value%' contém caracteres inválidos", - "'%value%' should have a length of %length% characters" => "'%value%' tem um comprimento de %length% caracteres", - 'Invalid type given, value should be string' => 'O tipo especificado é inválido, o valor deve ser string', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' não está entre '%min%' e '%max%', inclusivamente", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' não está exatamente entre '%min%' e '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' não é válido", - 'Failure within the callback, exception returned' => 'Falha na chamada de retorno, exceção retornada', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' deve conter entre 13 e 19 dígitos", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "O algoritmo de Luhn (checksum de módulo 10) falhou em '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "O algoritmo de Luhn (checksum de módulo 10) falhou em '%value%'", - "'%value%' must contain only digits" => "'%value%' deve conter apenas dígitos", - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' contains an invalid amount of digits" => "'%value%' contém uma quantidade inválida de dígitos", - "'%value%' is not from an allowed institute" => "'%value%' não vem de uma instituição autorizada", - "Validation of '%value%' has been failed by the service" => "A validação de '%value%' falhou por causa do serviço", - "The service returned a failure while validating '%value%'" => "O serviço devolveu um erro enquanto validava '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'O tipo especificado é inválido, o valor deve ser string, inteiro, matriz ou Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' não parece ser uma data válida", - "'%value%' does not fit the date format '%format%'" => "'%value%' não se encaixa no formato de data '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Não foram encontrados registros para %value%', - "A record matching '%value%' was found" => 'Um registro foi encontrado para %value%', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'O tipo especificado é inválido, o valor deve ser string, inteiro ou float', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' contém caracteres que não são dígitos, mas apenas dígitos são permitidos", - "'%value%' is an empty string" => "'%value%' é uma string vazia", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' não é um endereço de e-mail válido no formato local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' não é um nome de host válido para o endereço de e-mail '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' não parece ter um registro MX válido para o endereço de e-mail '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' não é um segmento de rede roteável. O endereço de e-mail '%value%' não deve ser resolvido a partir de um rede pública.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' não corresponde com o formato dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' não corresponde com o formato quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' não é uma parte local válida para o endereço de e-mail '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' excede o comprimento permitido", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Há muitos arquivos, são permitidos no máximo '%max%', mas '%count%' foram fornecidos", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Há poucos arquivos, são esperados no mínimo '%min%', mas '%count%' foram fornecidos", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "O arquivo '%value%' não corresponde ao hash crc32 fornecido", - 'A crc32 hash could not be evaluated for the given file' => 'Não foi possível avaliar um hash crc32 para o arquivo fornecido', - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "O arquivo '%value%' possui a extensão incorreta", - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "O arquivo '%value%' tem o mimetype incorreto: '%type%'", - "The mimetype of file '%value%' could not be detected" => "O mimetype do arquivo '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "O arquivo '%value%' não existe", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "O arquivo '%value%' possui a extensão incorreta", - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Todos os arquivos devem ter um tamanho máximo de '%max%', mas um tamanho de '%size%' foi detectado", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Todos os arquivos devem ter um tamanho mínimo de '%min%', mas um tamanho de '%size%' foi detectado", - 'One or more files can not be read' => 'Um ou mais arquivos não puderam ser lidos', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "O arquivo '%value%' não corresponde ao hash fornecido", - 'A hash could not be evaluated for the given file' => 'Não foi possível avaliar um hash para o arquivo fornecido', - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "A largura máxima permitida para a imagem '%value%' deve ser '%maxwidth%', mas '%width%' foi detectada", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "A largura mínima esperada para a imagem '%value%' deve ser '%minwidth%', mas '%width%' foi detectada", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "A altura máxima permitida para a imagem '%value%' deve ser '%maxheight%', mas '%height%' foi detectada", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "A altura mínima esperada para a imagem '%value%' deve ser '%minheight%', mas '%height%' foi detectada", - "The size of image '%value%' could not be detected" => "O tamanho da imagem '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "O arquivo '%value%' não está compactado: '%type%' detectado", - "The mimetype of file '%value%' could not be detected" => "O mimetype do arquivo '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "O arquivo '%value%' não é uma imagem: '%type%' detectado", - "The mimetype of file '%value%' could not be detected" => "O mimetype do arquivo '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "O arquivo '%value%' não corresponde ao hash md5 fornecido", - 'A md5 hash could not be evaluated for the given file' => 'Não foi possível avaliar um hash md5 para o arquivo fornecido', - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "O arquivo '%value%' tem o mimetype incorreto: '%type%'", - "The mimetype of file '%value%' could not be detected" => "O mimetype do arquivo '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "O arquivo '%value%' existe", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "O arquivo '%value%' não corresponde ao hash sha1 fornecido", - 'A sha1 hash could not be evaluated for the given file' => 'Não foi possível avaliar um hash sha1 para o arquivo fornecido', - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "O tamanho máximo permitido para o arquivo '%value%' é '%max%', mas '%size%' foram detectados", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "O tamanho mínimo esperado para o arquivo '%value%' é '%min%', mas '%size%' foram detectados", - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "O arquivo '%value%' excede o tamanho definido na configuração", - "File '%value%' exceeds the defined form size" => "O arquivo '%value%' excede o tamanho definido do formulário", - "File '%value%' was only partially uploaded" => "O arquivo '%value%' foi apenas parcialmente enviado", - "File '%value%' was not uploaded" => "O arquivo '%value%' não foi enviado", - "No temporary directory was found for file '%value%'" => "Nenhum diretório temporário foi encontrado para o arquivo '%value%'", - "File '%value%' can't be written" => "O arquivo '%value%' não pôde ser escrito", - "A PHP extension returned an error while uploading the file '%value%'" => "Uma extensão do PHP retornou um erro enquanto o arquivo '%value%' era enviado", - "File '%value%' was illegally uploaded. This could be a possible attack" => "O arquivo '%value%' foi enviado ilegalmente. Este poderia ser um possível ataque", - "File '%value%' was not found" => "O arquivo '%value%' não foi encontrado", - "Unknown error while uploading file '%value%'" => "Erro desconhecido ao enviar o arquivo '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Há muitas palavras, são permitidas no máximo '%max%', mas '%count%' foram contadas", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Há poucas palavras, são esperadas no mínimo '%min%', mas '%count%' foram contadas", - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'O tipo especificado é inválido, o valor deve ser float, string, ou inteiro', - "'%value%' does not appear to be a float" => "'%value%' não parece ser um float", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' não é maior que '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' has not only hexadecimal digit characters" => "'%value%' não contém somente caracteres hexadecimais", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' parece ser um endereço de IP, mas endereços de IP não são permitidos", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' parece ser um hostname de DNS, mas o TLD não corresponde a nenhum TLD conhecido", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' parece ser um hostname de DNS, mas contém um traço em uma posição inválida", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' parece ser um hostname de DNS, mas não corresponde ao esquema de hostname para o TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' parece ser um hostname de DNS, mas o TLD não pôde ser extraído", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' não corresponde com a estrutura esperada para um hostname de DNS", - "'%value%' does not appear to be a valid local network name" => "'%value%' não parece ser um nome de rede local válido", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' parece ser um nome de rede local, mas os nomes de rede local não são permitidos", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' parece ser um hostname de DNS, mas a notação punycode fornecida não pode ser decodificada", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "País desconhecido para o IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' não é um formato IBAN válido", - "'%value%' has failed the IBAN check" => "'%value%' falhou na verificação do IBAN", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Os dois tokens fornecidos não combinam', - 'No token was provided to match against' => 'Nenhum token foi fornecido para a comparação', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' não faz parte dos valores esperados", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'O tipo especificado é inválido, o valor deve ser string ou inteiro', - "'%value%' does not appear to be an integer" => "'%value%' não parece ser um número inteiro", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' does not appear to be a valid IP address" => "'%value%' não parece ser um endereço de IP válido", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'O tipo especificado é inválido, o valor deve ser string ou inteiro', - "'%value%' is not a valid ISBN number" => "'%value%' não é um número ISBN válido", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' não é menor que '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'O tipo especificado é inválido, o valor deve ser float, string, matriz, booleano ou inteiro', - "Value is required and can't be empty" => 'O valor é obrigatório e não pode estar vazio', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'O tipo especificado é inválido. O valor deve ser uma string ou um inteiro', - "'%value%' does not appear to be a postal code" => "'%value%' não parece ser um código postal", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'O tipo especificado é inválido, o valor deve ser string, inteiro ou float', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' não corresponde ao padrão '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Houve um erro interno durante o uso do padrão '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' não é um changefreq de sitemap válido", - 'Invalid type given, the value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' não é um lastmod de sitemap válido", - 'Invalid type given, the value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' não é uma localização de sitemap válida", - 'Invalid type given, the value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' não é uma prioridade de sitemap válida", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'O tipo especificado é inválido, o valor deve ser um inteiro, um float ou uma string numérica', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' is less than %min% characters long" => "O tamanho de '%value%' é inferior a %min% caracteres", - "'%value%' is more than %max% characters long" => "O tamanho de '%value%' é superior a %max% caracteres", -]; diff --git a/resources/languages/ru/Zend_Validate.php b/resources/languages/ru/Zend_Validate.php deleted file mode 100644 index 3f526a59f..000000000 --- a/resources/languages/ru/Zend_Validate.php +++ /dev/null @@ -1,254 +0,0 @@ - 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой или целым числом', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' содержит недопустимые символы. Разрешены только буквенные символы и цифры", - "'%value%' is an empty string" => "'%value%' - пустая строка", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' contains non alphabetic characters" => "'%value%' содержит не буквенные символы", - "'%value%' is an empty string" => "'%value%' - пустая строка", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' ошибка проверки контрольной суммы", - "'%value%' contains invalid characters" => "'%value%' содержит недопустимые символы", - "'%value%' should have a length of %length% characters" => "Длина '%value%' должна составлять %length% символов", - 'Invalid type given, value should be string' => 'Недопустимый тип данных, значение должно быть строкой', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' не в диапазоне от '%min%' до '%max%', включительно", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' не в диапазоне от '%min%' до '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' недопустимое значение", - 'Failure within the callback, exception returned' => 'Ошибка в обратном вызове, возвращено исключение', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' должно содержать от 13 до 19 цифр", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Алгоритм Луна (вычисление контрольной цифры) вернул ошибку для '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Алгоритм Луна (вычисление контрольной цифры) вернул ошибку для '%value%'", - "'%value%' must contain only digits" => "'%value%' должно содержать только цифры", - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' contains an invalid amount of digits" => "'%value%' содержит недопустимое количество цифр", - "'%value%' is not from an allowed institute" => "'%value%' не входит в список разрешенных платежных систем", - "Validation of '%value%' has been failed by the service" => "Проверка '%value%' закончилась ошибкой сервиса", - "The service returned a failure while validating '%value%'" => "Сервис возвратил ошибку во время проверки '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'Недопустимый тип данных, значение должно быть строкой, целым числом, массивом или объектом Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' не является корректной датой", - "'%value%' does not fit the date format '%format%'" => "'%value%' не соответствует формату даты '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Не найдено записей, совпадающих с '%value%'", - "A record matching '%value%' was found" => "Найдена запись, совпадающая со значением '%value%'", - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой, или целым числом', - "'%value%' contains not only digit characters" => "Значение '%value%' должно содержать только цифровые символы", - "'%value%' is an empty string" => "'%value%' - пустая строка", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' недопустимый адрес электронной почты. Введите его в формате имя@домен", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' недопустимое имя хоста для адреса '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' не имеет корректной MX-записи об адресе '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' не является маршрутизируемым сегментом сети. Адрес электронной почты '%value%' не может быть получен из публичной сети.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart% не соответствует формату dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' не соответствует формату quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' недопустимое имя для адреса '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' превышает допустимую длину", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Слишком много файлов, максимально разрешено - '%max%', а получено - '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Слишком мало файлов, минимально разрешено - '%min%', а получено - '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Файл '%value%' не соответствует заданному crc32 хешу", - 'A crc32 hash could not be evaluated for the given file' => 'crc32 хеш не может быть вычислен для данного файла', - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Файл '%value%' имеет недопустимое расширение", - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "MIME-тип '%type%' файла '%value%' недопустим", - "The mimetype of file '%value%' could not be detected" => "Не удается определить MIME-тип файла '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Файл '%value%' не существует", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Файл '%value%' имеет недопустимое расширение", - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Общий размер файлов не должен превышать '%max%', сейчас - '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Общий размер файлов не должен быть менее '%min%', сейчас - '%size%'", - 'One or more files can not be read' => 'Один или более файлов не могут быть прочитаны', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Файл '%value%' не соответствует указанному хешу", - 'A hash could not be evaluated for the given file' => 'Хеш не может быть подсчитан для указанного файла', - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Максимально разрешённая ширина изображения '%value%' должна быть '%maxwidth%', сейчас - '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Минимально ожидаемая ширина изображения '%value%' должна быть '%minwidth%', сейчас - '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Максимально разрешённая высота изображения '%value%' должна быть '%maxheight%', сейчас - '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Минимально ожидаемая высота изображения '%value%' должна быть '%minheight%', сейчас - '%height%'", - "The size of image '%value%' could not be detected" => "Невозможно определить размер изображения '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Файл '%value%' не является сжатым. MIME-тип файла - '%type%'", - "The mimetype of file '%value%' could not be detected" => "Не удается определить MIME-тип файла '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Файл '%value%' не является изображением. MIME-тип файла - '%type%'", - "The mimetype of file '%value%' could not be detected" => "Не удается определить MIME-тип файла '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Файл '%value%' не соответствует указанному md5 хешу", - 'A md5 hash could not be evaluated for the given file' => 'md5 хеш не может быть вычислен для указанного файла', - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "MIME-тип '%type%' файла '%value%' недопустим", - "The mimetype of file '%value%' could not be detected" => "Не удается определить MIME-тип файла '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Файл '%value%' уже существует", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Файл '%value%' не соответствует указаному хешу sha1", - 'A sha1 hash could not be evaluated for the given file' => 'Хеш sha1 не может быть подсчитан для указанного файла', - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Максимальный разрешенный размер файла '%value%' это '%max%', сейчас - '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Минимальный разрешенный размер файла '%value%' это '%min%', сейчас - '%size%'", - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Размер файла '%value%' превышает допустимый размер, указанный в php.ini", - "File '%value%' exceeds the defined form size" => "Размер файла '%value%' превышает допустимый размер, указанный в форме", - "File '%value%' was only partially uploaded" => "Файл '%value%' был загружен только частично", - "File '%value%' was not uploaded" => "Файл '%value%' не был загружен", - "No temporary directory was found for file '%value%'" => "Не найдена временная директория для файла '%value%'", - "File '%value%' can't be written" => "Файл '%value%' не может быть записан", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP расширение возвратило ошибку во время загрузки файла '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Файл '%value%' загружен некорректно. Возможна атака", - "File '%value%' was not found" => "Файл '%value%' не найден", - "Unknown error while uploading file '%value%'" => "Произошла неизвестная ошибка во время загрузки файла '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Слишком много слов, разрешено максимум '%max%' слов, но сейчас - '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Слишком мало слов, разрешено минимум '%min%' слов, но сейчас - '%count%'", - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой, или целым числом', - "'%value%' does not appear to be a float" => "'%value%' не является числом с плавающей точкой", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' не превышает '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' has not only hexadecimal digit characters" => "Значение '%value%' должно содержать только шестнадцатиричные символы", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "Значение '%value%' выглядит как IP-адрес, но IP-адреса не разрешены", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' выглядит как DNS имя хоста, но оно не дожно быть из списка доменов верхнего уровня", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' выглядит как DNS имя хоста, но знак '-' находится в недопустимом месте", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' выглядит как DNS имя хоста, но оно не соответствует шаблону для доменных имен верхнего уровня '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' выглядит как DNS имя хоста, но не удаётся извлечь домен верхнего уровня", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' не соответствует ожидаемой структуре для DNS имени хоста", - "'%value%' does not appear to be a valid local network name" => "'%value%' является недопустимым локальным сетевым адресом", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' выглядит как локальный сетевой адрес, но локальные сетевые адреса не разрешены", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' выглядит как DNS имя хоста, но указанное значение не может быть преобразованно в допустимый для DNS набор символов", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Не известная страна IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' имеет недопустимый IBAN формат", - "'%value%' has failed the IBAN check" => "'%value%' не прошло IBAN проверку", - - // Zend_Validate_Identical - "The token '%token%' does not match the given token '%value%'" => "Значение '%token%' не совпадает с указанным значением '%value%'", - 'No token was provided to match against' => 'Не было указано значение для проверки на идентичность', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' не найдено в перечисленных допустимых значениях", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Недопустимый тип данных, значение должно быть строкой или целым числом', - "'%value%' does not appear to be an integer" => "'%value%' не является целым числом", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' does not appear to be a valid IP address" => "'%value%' не является корректным IP-адресом", - - // Zend_Validate_Isbn - "'%value%' is not a valid ISBN number" => "'%value%' не является корректным номером ISBN", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' не меньше, чем '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой, массивом, булевым значением или целым числом', - "Value is required and can't be empty" => 'Значение обязательно для заполнения и не может быть пустым', - - // Zend_Validate_PostCode - 'Invalid type given, value should be string or integer' => 'Недопустимый тип данных, значение должно быть строкой или целым числом', - "'%value%' does not appear to be an postal code" => "'%value%' не является корректным почтовым кодом", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой, или целым числом', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' не соответствует шаблону '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' недопустимое значение для sitemap changefreq", - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' недопустимое значение для sitemap lastmod", - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' недопустимое значение для sitemap location", - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' недопустимое значение для sitemap priority", - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' is less than %min% characters long" => "'%value%' меньше разрешенной минимальной длины в %min% символов", - "'%value%' is more than %max% characters long" => "'%value%' больше разрешенной максимальной длины в %max% символов", -]; diff --git a/resources/languages/sk/Zend_Captcha.php b/resources/languages/sk/Zend_Captcha.php deleted file mode 100644 index b89c114d5..000000000 --- a/resources/languages/sk/Zend_Captcha.php +++ /dev/null @@ -1,31 +0,0 @@ - 'Chýba captcha pole', - 'Failed to validate captcha' => 'Captchu sa nepodarilo overiť', - 'Captcha value is wrong: %value%' => 'Hodnota captchy neni správna: %value%', - - // Zend_Captcha_Word - 'Empty captcha value' => 'Hodnota captchy nebola zadaná', - 'Captcha ID field is missing' => 'Chýba pole captcha ID', - 'Captcha value is wrong' => 'Chybná hodnota catpchy', -]; diff --git a/resources/languages/sk/Zend_Validate.php b/resources/languages/sk/Zend_Validate.php deleted file mode 100644 index 501de96c2..000000000 --- a/resources/languages/sk/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' obsahuje aj iné znaky ako písmena a číslice", - "'%value%' is an empty string" => "'%value%' je prázdny reťazec", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' contains non alphabetic characters" => "'%value%' obsahuje aj iné znaky ako písmena", - "'%value%' is an empty string" => "'%value%' je prázdny reťazec", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' má chybný kontrolný súčet", - "'%value%' contains invalid characters" => "'%value%' obsahuje neplatné znaky", - "'%value%' should have a length of %length% characters" => "'%value%' by mal mať dĺžku %length% znakov", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec.', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' nie je medzi '%min%' a '%max%', vrátane", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' nie je medzi '%min%' a '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "Hodnota '%value%' je neplatná", - 'An exception has been raised within the callback' => 'Počas validácie došlo chybe', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' musí obsahovať 13 až 19 číslic", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhnov algoritmus (kontrolný súčet mod-10) nevyšiel pre '%value%'", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "'%value%' obsahuje neplatný kontrolný súčet", - "'%value%' must contain only digits" => "'%value%' musí obsahovať len čísla", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' contains an invalid amount of digits" => "'%value%' obsahuje neplatný počet číslic", - "'%value%' is not from an allowed institute" => "'%value%' je od nepovolenej spoločnosti", - "'%value%' seems to be an invalid creditcard number" => "'%value%' je neplatné číslo kreditnej karty", - "An exception has been raised while validating '%value%'" => "Počas validácie '%value%' došlo k chybe", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Chybný typ. Bol očakávaný reťazec, číslo, pole alebo objekt typu Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' je neplatný dátum", - "'%value%' does not fit the date format '%format%'" => "'%value%' nie je formátu '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Nebol nájdený žiadny záznam zhodný s '%value%'", - "A record matching '%value%' was found" => "Bol nájdený záznam zhodný s '%value%'", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo', - "'%value%' must contain only digits" => "'%value%' musí obsahovať iba číslice", - "'%value%' is an empty string" => "'%value%' je prázdny reťazec", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' nie je platná e-mailová adresa v tvare local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' je neplatný hostname pre emailovou adresu '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' neobsahuje platný MX záznam pre e-mailovou adresu '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' nie je v smerovateľnom úseku siete. E-mailová adresa '%value%' by nemala byť požadovaná z verejnej siete", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' nemôže byť porovnaný proti dot-atom formátu", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' nemôže byť porovnaný proti quoted-string formátu", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' je neplatná 'local part' pre e-mailovou adresu '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' prekročil dovolenú dĺžku", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Príliš veľa súborov. Maximum je '%max%', ale bolo zadaných '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Píliš málo súborov. Minimum je '%min%', ale bolo zadaných len '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Súbor '%value%' nezodpovedá zadanému crc32 hashu", - 'A crc32 hash could not be evaluated for the given file' => 'Pre zadaný súbor nemohol byť vypočítaný crc32 hash', - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Súbor '%value%' má nesprávnu príponu", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Súbor '%value%' má nesprávny mimetyp '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp súboru '%value%' nebolo možne zistiť", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Súbor '%value%' neexistuje", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Súbor '%value%' má nesprávnu príponu", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Súčet veľkostí všetkých súborov by mal byť maximálne '%max%', ale je '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Súčet veľkosti všetkých súborov by mal byť minimálne '%min%', ale je '%size%'", - 'One or more files can not be read' => 'Jeden alebo viac súborov nie je možné načítať', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Súbor '%value%' neodpovedá danému hashu", - 'A hash could not be evaluated for the given file' => 'Hash nemohol byť pre daný súbor vypočítaný', - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maximálna šírka obrázka '%value%' by mala byť '%maxwidth%', ale je '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimálna šírka obrázka '%value%' by mala byť '%minwidth%', ale je '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maximálna výška obrázka '%value%' by mala byť '%maxheight%', ale je '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimálna výška obrázka '%value%' by mala byť '%minheight%', ale je '%height%'", - "The size of image '%value%' could not be detected" => "Rozmery obrázka '%value%' nebolo možné zistiť", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Súbor '%value%' nie je komprimovaný, typ súboru '%type%' bol zistený", - "The mimetype of file '%value%' could not be detected" => "Mimetyp súboru '%value%' nebolo možné zistiť", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Súbor '%value%' nie je obrázok, typ súboru '%type%' bol zistený", - "The mimetype of file '%value%' could not be detected" => "Mimetyp súboru '%value%' nebolo možné zistiť", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Súbor '%value%' neodpovedá danému md5 hashu", - 'A md5 hash could not be evaluated for the given file' => 'md5 hash nemohol byť pre daný súbor vypočítaný', - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Súbor '%value%' má neplatný mimetyp '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp súboru '%value%' nebolo možne zistiť", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Súbor '%value%' už existuje", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Súbor '%value%' neodpovedá danému sha1 hashu", - 'A sha1 hash could not be evaluated for the given file' => 'sha1 hash nemohol byť pre daný súbor vypočítaný', - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maximálna povolená veľkosť súboru je '%max%', ale '%value%' má '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimálna veľkosť súboru je '%min%', ale '%value%' má '%size%'", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Súbor '%value%' prekročil veľkosť definovanú v ini súbore", - "File '%value%' exceeds the defined form size" => "Súbor '%value%' prekročil veľkosť definovanú vo formulári", - "File '%value%' was only partially uploaded" => "Súbor '%value%' bol nahraný len čiastočne", - "File '%value%' was not uploaded" => "Súbor '%value%' nebol nahraný", - "No temporary directory was found for file '%value%'" => "Pre súbor '%value%' nebol nájdený žiadny dočasný adresár", - "File '%value%' can't be written" => "Súbor '%value%' nemôže byť zapísaný", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP rozšírenie vrátilo chybu počas nahrávania súboru '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Súbor '%value%' bol nahraný neoprávnene. Môže sa jednať o útok", - "File '%value%' was not found" => "Súbor '%value%' nebol nalezený", - "Unknown error while uploading file '%value%'" => "Počas nahrávania súboru '%value%' došlo k chybe", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Príliš mnoho slov. Je ich dovolené maximálne '%max%', ale bolo zadaných '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Príliš málo slov. Musí ich byť minimálne '%min%', ale bolo zadaných len '%count%'", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo', - "'%value%' does not appear to be a float" => "'%value%' nie je desatinné číslo", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' nie je viac ako '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' has not only hexadecimal digit characters" => "'%value%' musí obsahovať len znaky hexadecimálnych čísel.", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' vyzerá ako IP adresa, ale tie nie sú dovolené", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' vyzerá ako hostname, ale nemohol byť overený proti známym TLD", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' vyzerá ako hostname, ale obsahuje pomlčku na nepovolenom mieste", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' vyzerá ako hostname, ale neodpovedá formátu hostname pre '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' síce vyzerá ako hostname, ale nebolo možné určiť TLD", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' nezodpovedá očakávanej štruktúre hostname", - "'%value%' does not appear to be a valid local network name" => "'%value%' nevyzerá ako platné sieťové meno", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' vyzerá ako hostname lokálnej siete, tie ale nie sú dovolené", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' vyzerá ako DNS hostname ale zadanú punycode notáciu nie je možné dekódovať", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Neznámy štát v IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' je neplatný formát IBAN", - "'%value%' has failed the IBAN check" => "'%value%' neprešiel kontrolou IBAN", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Zadané položky sú rozdielne', - 'No token was provided to match against' => 'Nebola zadaná položka na porovnanie', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' nebola nájdená v zozname", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Chybný typ. Bol očakávaný reťazec alebo celé číslo', - "'%value%' does not appear to be an integer" => "'%value%' nie je celé číslo", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' does not appear to be a valid IP address" => "'%value%' je neplatná IP adresa", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Chybný typ. Bol očakávaný reťazec alebo celé číslo', - "'%value%' is not a valid ISBN number" => "'%value%' je neplatný ISBN", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' nie je menej ako '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo, boolean alebo pole', - "Value is required and can't be empty" => 'Položka je povinná a nemôže byť prázdna', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Chybný typ. Bol očakávaný reťazec alebo celé číslo', - "'%value%' does not appear to be a postal code" => "'%value%' nevyzerá ako PSČ", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' neodpovedá šablóne '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Počas spracovania šablóny '%pattern%' došlo k interní chybe", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' je neplatný 'changefreq' pre sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' je neplatný 'lastmod' pre sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' je neplatný 'location' pre sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' je neplatná 'priority' pre sitemapu", - 'Invalid type given. Numeric string, integer or float expected' => 'Chybný typ. Bol očakávaný číselný reťazec, celé alebo desatinné číslo.', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' is less than %min% characters long" => "'%value%' ma menej ako %min% znakov", - "'%value%' is more than %max% characters long" => "'%value%' ma viac ako %max% znakov", -]; diff --git a/resources/languages/sr/Zend_Validate.php b/resources/languages/sr/Zend_Validate.php deleted file mode 100644 index c74cdc56c..000000000 --- a/resources/languages/sr/Zend_Validate.php +++ /dev/null @@ -1,261 +0,0 @@ - 'Nevalidan tip, vrednost treba da bude tekst ili broj', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' sadrži karaktere koji nisu slova niti cifre", - "'%value%' is an empty string" => "'%value%' je prazan tekst", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' contains non alphabetic characters" => "'%value%' sadrži karaktere koji nisu slova", - "'%value%' is an empty string" => "'%value%' je prazan tekst", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' greška u checksum validaciji", - "'%value%' contains invalid characters" => "'%value%' sadrži nevalidne karaktere", - "'%value%' should have a length of %length% characters" => "'%value%' treba da bude dužine %length%", - 'Invalid type given, value should be string' => 'Nevalidan tip, vrednost treba da bude tekst', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' nije između '%min%' i '%max%', uključivo", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' nije strogo između '%min%' i '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' nije validno", - 'Failure within the callback, exception returned' => 'Greška u pozivu', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' treba da sadrži između 13 i 19 cifara", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algoritam ne prolazi na '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algoritam ne prolazi na '%value%'", - "'%value%' must contain only digits" => "'%value%' treba da sadrži samo cifre", - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' contains an invalid amount of digits" => "'%value%' sadrži nevalidu količinu cifara", - "'%value%' is not from an allowed institute" => "'%value%' nije iz dozvoljene institucije", - "Validation of '%value%' has been failed by the service" => "Validacija '%value%' nije uspela od strane servisa", - "The service returned a failure while validating '%value%'" => "Servis je vratio grešku pri validaciji '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'Nevalidan tip, vrednost treba da bude tekst, ceo broj, niz ili Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' nije validan datum", - "'%value%' does not fit the date format '%format%'" => "'%value%' nije u formatu datuma '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Zapis koji se poklapa sa %value% nije pronađen', - "A record matching '%value%' was found" => 'Zapis koji se poklapa sa %value% je pronađen', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Nevalidan tip, vrednost treba da bude tekst ili broj', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' sadrži karaktere koji nisu cifre, a samo cifre su dozvoljene", - "'%value%' contains not only digit characters" => "'%value%' ne sadrži samo cifre", - "'%value%' is an empty string" => "'%value%' je prazan tekst", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' nije validna adresa elektronske pošte u formatu adresa@imehosta", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' nije validno ime hosta za adresu elektronske pošte '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' nema validan MX zapis za adresu elektronske pošte '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' nije rutabilan mrežni segment. Adresa elektronske pošte '%value%' ne treba da bude razrešena sa javne mreže", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' se ne poklapa sa dot-atom formatom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' se ne poklapa sa quoted-string formatom", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' nije validan deo adrese elektronske pošte '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' prelazi dozvoljenu dužinu", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Preveliki broj fajlova, maksimalno '%max%' je dozvoljeno, a '%count%' je prosleđeno", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Premali broj fajlova, minimalno '%min%' je očekivano, a '%count%' je prosleđeno", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Fajl '%value%' ne prolazi crc32 proveru", - 'A crc32 hash could not be evaluated for the given file' => 'Nema crc32 kodova za dati fajl', - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Fajl '%value%' ima nevalidnu ekstenziju", - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Fajl '%value%' ima nevalidan mime-tip '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mime-tip fajla '%value%' ne može biti detektovan", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Fajl '%value%' ne postoji", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Fajl '%value%' ima nevalidnu ekstenziju", - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Svi fajlovi u zbiru treba da imaju maksimalnu veličinu '%max%', veličina poslatih fajlova je '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Svi fajlovi u zbiru treba da imaju minimalnu veličinu '%min%', veličina poslatih fajlova je '%size%'", - 'One or more files can not be read' => 'Jedan ili više fajlova ne može biti pročitan', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Fajl '%value%' je nepravilno kodiran", - 'A hash could not be evaluated for the given file' => 'Heševi nisu pronađeni za dati fajl', - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maksimalna dozvoljena širina slike '%value%' je '%maxwidth%', data slika ima širinu '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimalna očekivana širina slike '%value%' je '%minwidth%', data slika ima širinu '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maksimalna dozvoljena visina slike '%value%' je '%maxheight%', data slika ima visinu '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimalna očekivana visina slike '%value%' je '%minheight%', data slika ima visinu '%height%'", - "The size of image '%value%' could not be detected" => "Veličina slike '%value%' ne može biti određena", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Fajl '%value%' nije kompresovan, '%type%' detektovan", - "The mimetype of file '%value%' could not be detected" => "Mime-tip fajla '%value%' ne može biti detektovan", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Fajl '%value%' nije slika, '%type%' detektovan", - "The mimetype of file '%value%' could not be detected" => "Mime-tip fajla '%value%' ne može biti detektovan", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Fajl '%value%' ne prolazi md5 proveru", - 'A md5 hash could not be evaluated for the given file' => 'Nema md5 heševa za dati fajl', - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Fajl '%value%' ima nevalidan mime-tip '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mime-tip fajla '%value%' ne može biti detektovan", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Fajl '%value%' postoji", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Fajl '%value%' ne prolazi sha1 proveru", - 'A sha1 hash could not be evaluated for the given file' => 'Nema sha1 heševa za dati fajl', - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maksimalna dozvoljena veličina fajla '%value%' je '%max%', data veličina je '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimalna očekivana veličina fajla '%value%' je '%min%', data veličina je '%size%'", - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Fajl '%value%' prevazilazi maksimalnu dozvoljenu veličinu", - "File '%value%' exceeds the defined form size" => "Fajl '%value%' prevazilazi maksimalnu dozvoljenu veličinu", - "File '%value%' was only partially uploaded" => "Fajl '%value%' je samo parcijalno uploadovan", - "File '%value%' was not uploaded" => "Fajl '%value%' nije uploadovan", - "No temporary directory was found for file '%value%'" => "Privremeni direktorijum nije pronađen za fajl '%value%'", - "File '%value%' can't be written" => "Fajl '%value%' ne može biti izmenjen", - "A PHP extension returned an error while uploading the file '%value%'" => "Ekstenzija je vratila grešku tokom uploada fajla '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Fajl '%value%' je ilegalno uploadovan, moguć napad", - "File '%value%' was not found" => "Fajl '%value%' nije pronađen", - "Unknown error while uploading file '%value%'" => "Nepoznata greška pri uploadu fajla '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Previše reči, maksimalno '%max%' je dozvoljeno, '%count%' je izbrojano", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Premalo reči, minimalno '%min%' je očekivano, '%count%' je izbrojano", - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Nevalidan tip, vrednost treba da bude tekst ili broj', - "'%value%' does not appear to be a float" => "'%value%' nije razlomljeni broj", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' nije veće od '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' has not only hexadecimal digit characters" => "'%value%' se ne sastoji samo od heksadecimalnih karaktera", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' je IP adresa, IP adrese nisu dozvoljene", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' je DNS ime hosta, ali TLD nije u listi poznatih", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' je DNS ime hosta, ali sadrži srednju crtu (-) na nedozvoljenoj poziciji", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' je DNS ime hosta, ali se ne poklapa sa šemom za '%tld%' TLD", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' je DNS ime hosta, ali ne može da se ekstraktuje TLD deo '%tld%'", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' se ne poklapa sa očekivanom strukturom DNS imena hosta", - "'%value%' does not appear to be a valid local network name" => "'%value%' nije validno ime lokalne mreže", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' je ime lokalne mreže, lokalna imena mreža nisu dozvoljena", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' je DNS ime hosta, ali data punikod notacija ne može biti dekodirana", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Nepoznata zemlja u IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' nije u validnom IBAN formatu", - "'%value%' has failed the IBAN check" => "'%value%' ne prolazi IBAN proveru", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Tokeni se ne poklapaju', - 'No token was provided to match against' => 'Token za proveru nije prosleđen', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' nije pronađeno u gomili", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Nevalidan tip, vrednost treba da bude tekst ili ceo broj', - "'%value%' does not appear to be an integer" => "'%value%' nije ceo broj", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' does not appear to be a valid IP address" => "'%value%' nije validna IP adresa", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'Nevalidan tip, vrednost treba da bude tekst ili ceo broj', - "'%value%' is not a valid ISBN number" => "'%value%' nije validan ISBN broj", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' je manje od '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'Nevalidan tip, vrednost treba da bude tekst, broj ili logička vrednost', - "Value is required and can't be empty" => 'Vrednost je obavezna i ne sme biti prazna', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'Nevalidan tip. Vrednost treba da bude tekst ili ceo broj', - "'%value%' does not appear to be a postal code" => "'%value%' nije poštanski broj", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Nevalidan tip, vrednost treba da bude tekst ili broj', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' se ne poklapa sa formatom '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Dogodila se greška pri korišćenju formata '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' nije validna frekvencija promene mape sajta", - 'Invalid type given, the value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' nije validan datum izmene mape sajta", - 'Invalid type given, the value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' nije validna lokacija mape sajta", - 'Invalid type given, the value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' nije validan prioritet mape sajta", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'Nevalidan tip, vrednost treba da bude broj ili numerički niz', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' is less than %min% characters long" => "'%value%' ima manje od %min% karaktera", - "'%value%' is more than %max% characters long" => "'%value%' ima više od %max% karaktera", -]; diff --git a/resources/languages/uk/Zend_Validate.php b/resources/languages/uk/Zend_Validate.php deleted file mode 100644 index 635a23bc5..000000000 --- a/resources/languages/uk/Zend_Validate.php +++ /dev/null @@ -1,254 +0,0 @@ - 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком чи цілим числом', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' містить символи які не є літерами чи цифрами", - "'%value%' is an empty string" => "'%value%' - пустий рядок", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' contains non alphabetic characters" => "'%value%' містить символи які не є літерами", - "'%value%' is an empty string" => "'%value%' - пустий рядок", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' помилка перевірки контрольної суми", - "'%value%' contains invalid characters" => "'%value%' містить неприпустимі символи", - "'%value%' should have a length of %length% characters" => "Довжина '%value%' повинна складати %length% символів", - 'Invalid type given, value should be string' => 'Неприпустимий тип даних, значення повинно бути рядком', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' за межами діапазону від '%min%' до '%max%', включно", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' за межами діапазону від '%min%' до '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' - неприпустиме значення", - 'Failure within the callback, exception returned' => 'Помилка в зворотньому виклику, повернено виключення', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' має містити від 13 до 19 цифр", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Алгоритм Луна (обчислення контрольної цифри) повернув помилку для '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Алгоритм Луна (обчислення контрольної цифри) повернув помилку для '%value%'", - "'%value%' must contain only digits" => "'%value%' має містити тільки цифри", - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' contains an invalid amount of digits" => "'%value%' містить неприпустиму кількість цифр", - "'%value%' is not from an allowed institute" => "'%value%' не відноситься до дозволенних платіжних систем", - "Validation of '%value%' has been failed by the service" => "Перевірка '%value%' закінчилась помилкою сервісу", - "The service returned a failure while validating '%value%'" => "Сервіс повернув помилку під час перевірки '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => "Неприпустимий тип даних, значення повинно бути рядком, цілим числом, масивом чи об'єктом Zend_Date", - "'%value%' does not appear to be a valid date" => "'%value%' - некоректна дата", - "'%value%' does not fit the date format '%format%'" => "'%value%' не відповідає формату дати '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Не знайдено записів, що відповідають '%value%'", - "A record matching '%value%' was found" => "Знайдено запис, що відповідає '%value%'", - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком чи цілим числом', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' має містити тільки цифри", - "'%value%' is an empty string" => "'%value%' - пустий рядок", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно рядком', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' неприпустима адреса електронної пошти для формату ім'я@домен", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' неприпустиме ім'я хоста для адреси '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' не має коректного MX-запису про адресу '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' не є маршрутизованим сегментом мережі. Адреса електронної пошти '%value%' не може бути отримана з публічної мережі.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart% не відповідає формату dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' не відповідає формату quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' неприпустиме ім'я для адреси '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' перевищує дозволену довжину", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Занадто багато файлів, дозволено максимум - '%max%', отримано - '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Занадто мало файлів, дозволено мінімум - '%min%', отримано - '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Файл '%value%' не відповідає заданому crc32 хешу", - 'A crc32 hash could not be evaluated for the given file' => 'crc32 хеш не може бути обчисленний для цього файлу', - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Файл '%value%' має неприпустиме розширення", - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Файл '%value%' має неприпустимий MIME-тип '%type%'", - "The mimetype of file '%value%' could not be detected" => "Не вдається визначити MIME-тип файлу '%value%'", - "File '%value%' can not be read" => "Файл '%value%' неможливо прочитати", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Файл '%value%' не існує", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Файл '%value%' має неприпустиме розширення", - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Загальний розмір файлів не повинен перевищувати '%max%', зараз - '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Загальний розмір файлів має бути менше '%min%', зараз - '%size%'", - 'One or more files can not be read' => 'Неможливо прочитати один чи декілька файлів', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Файл '%value%' не відповідає вказаному хешу", - 'A hash could not be evaluated for the given file' => 'Не можливо обчислити хеш для вказаного файла', - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Максимально допустима ширина для зображення '%value%' - '%maxwidth%', зараз - '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Мінімально очікувана ширина для зображення '%value%' - '%minwidth%', зараз - '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Максимально допустима висота для зображення '%value%' - '%maxheight%', зараз - '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Мінімально очікувана ширина для зображення '%value%' - '%minheight%', зараз - '%height%'", - "The size of image '%value%' could not be detected" => "Неможливо визначити розмір зображення '%value%'", - "File '%value%' can not be read" => "Файл '%value%' неможливо прочитати", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Файл '%value%' не є стислий. MIME-тип файлу - '%type%'", - "The mimetype of file '%value%' could not be detected" => "Неможливо визначити MIME-тип файлу '%value%'", - "File '%value%' can not be read" => "Файл '%value%' неможливо прочитати", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Файл '%value%' не є зображенням. MIME-тип файлу - '%type%'", - "The mimetype of file '%value%' could not be detected" => "Неможливо визначити MIME-тип файлу '%value%'", - "File '%value%' can not be read" => "Файл '%value%' неможливо прочитати", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Файл '%value%' не відповідає вказаному md5 хешу", - 'A md5 hash could not be evaluated for the given file' => 'md5 хеш не може бути визначений для вказаного файлу', - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "MIME-тип '%type%' файлу '%value%' неприпустимий", - "The mimetype of file '%value%' could not be detected" => "Неможливо визначити MIME-тип файлу '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не можливо прочитати", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Файл '%value%' вже існує", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Файл '%value%' не відповідає хешу sha1", - 'A sha1 hash could not be evaluated for the given file' => 'Неможливо визначити sha1 хеш для вказаного файлу', - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Максимально дозволений розмір файлу '%value%' - '%max%', зараз - '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Мінімально дозволений розмір файлу '%value%' - '%min%', зараз - '%size%'", - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Розмір файлу '%value%' більше ніж дозволений, що вказаний в php.ini", - "File '%value%' exceeds the defined form size" => "Розмір файлу '%value%' більше ніж дозволений, що вказаний в формі", - "File '%value%' was only partially uploaded" => "Файл '%value%' був завантажений тільки частково", - "File '%value%' was not uploaded" => "Файл '%value%' не був завантажений", - "No temporary directory was found for file '%value%'" => "Не знайдено тимчасову директорію для файлу '%value%'", - "File '%value%' can't be written" => "Файл '%value%' не може бути записаний", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP розширення повернуло помилку під час завантаження фалу '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Файл '%value%' завантажений некоректно. Можлива атака", - "File '%value%' was not found" => "Файл '%value%' не знайдено", - "Unknown error while uploading file '%value%'" => "Під час завантаження файлу '%value%' виникла невідома помилка", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Занадто багато слів, дозволено максимум '%max%' слів, зараз - '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Занадто мало слів, дозволено мінімум '%min%' слів, зараз - '%count%'", - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком, або цілим числом', - "'%value%' does not appear to be a float" => "'%value%' не є числом з плаваючою крапкою", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' не більше ніж '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' has not only hexadecimal digit characters" => "Значення '%value%' повинно містити тільки шістнадцятирічні символи", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "Значення '%value%' виглядає як IP-адреса, але IP-адреси не дозволені", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' виглядає як DNS ім’я хоста, але воно не повинно бути зі списку доменів верхнього рівня", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' виглядає як DNS ім’я хоста, але знак '-' знаходиться в неприпустимому місці", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' виглядає як DNS ім’я хоста, але воно не відповідає шаблону для доменних імен верхнього рівня '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' виглядає як DNS ім’я хоста, але не вдається визначити домен верхнього рівня", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' не відповідає очікуваній структурі для DNS імені хоста", - "'%value%' does not appear to be a valid local network name" => "'%value%' є неприпустимим іменем локальної мережі", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' виглядає як ім’я локальної мережі, але імена локальних мереж не дозволені", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' виглядає як DNS ім’я хоста, але вказане значення не може бути перетворене в припустимий для DNS набір символів", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Невідома країна IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' має неприпустимий IBAN формат", - "'%value%' has failed the IBAN check" => "'%value%' не пройшло IBAN перевірку", - - // Zend_Validate_Identical - "The token '%token%' does not match the given token '%value%'" => "Значення '%token%' не співпадає з вказаним значенням '%value%'", - 'No token was provided to match against' => 'Не вказано значення для перевірки на ідентичність', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' не знайдено в списку допустимих значень", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Неприпустимий тип даних, значення повинно бути рядком чи цілим числом', - "'%value%' does not appear to be an integer" => "'%value%' не є цілим числом", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' does not appear to be a valid IP address" => "'%value%' - некоректна IP-адреса", - - // Zend_Validate_Isbn - "'%value%' is not a valid ISBN number" => "'%value%' - некоректний номер ISBN", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' не менше ніж '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком, масивом чи цілим числом', - "Value is required and can't be empty" => "Значення обов'язкове і не може бути порожнім", - - // Zend_Validate_PostCode - 'Invalid type given, value should be string or integer' => 'Неприпустимий тип даних, значення повинно бути рядком чи цілим числом', - "'%value%' does not appear to be an postal code" => "'%value%' не являється поштовим індексом", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком чи цілим числом', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' не відповідає шаблону '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' неприпустиме значення для sitemap changefreq", - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' неприпустиме значення для sitemap lastmod", - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' неприпустиме значення для sitemap location", - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' неприпустиме значення для sitemap priority", - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' is less than %min% characters long" => "Довжина '%value%' менше %min% символів", - "'%value%' is more than %max% characters long" => "Довжина '%value%' перевищує %max% символів", -]; diff --git a/tests/TestConfiguration.php.dist b/tests/TestConfiguration.php.dist index 3e51c8c82..80a2920c2 100644 --- a/tests/TestConfiguration.php.dist +++ b/tests/TestConfiguration.php.dist @@ -41,14 +41,6 @@ */ defined('TESTS_ZEND_OB_ENABLED') || define('TESTS_ZEND_OB_ENABLED', false); -/** - * Zend_Cloud online tests - * - * You may need to provide connection details for specific adapters under their - * specific configuration settings elsewhere in this file. - */ -defined('TESTS_ZEND_CLOUD_STORAGE_WINDOWSAZURE_CONTAINER') || define('TESTS_ZEND_CLOUD_STORAGE_WINDOWSAZURE_CONTAINER', 'simplecloudcontainer'); - /** * Zend_Controller @@ -58,109 +50,6 @@ defined('TESTS_ZEND_CLOUD_STORAGE_WINDOWSAZURE_CONTAINER') || define('TESTS_ZEND */ defined('TESTS_ZEND_CONTROLLER_DISPATCHER_OB') || define('TESTS_ZEND_CONTROLLER_DISPATCHER_OB', false); -/** - * Zend_Feed_Rss/Zend_Feed_Atom online tests - * - * Set the BASEURI to a vhost pointed at the tests/Zend/Feed/_files - * subdirectory to enable these tests. - */ -defined('TESTS_ZEND_FEED_IMPORT_ONLINE_BASEURI') || define('TESTS_ZEND_FEED_IMPORT_ONLINE_BASEURI', false); - -/** - * Zend_Feed_Reader tests - * - * If the ONLINE_ENABLED property is false, only tests that can be executed - * without network connectivity are run; when enabled, all tests will run. - */ -defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') || define('TESTS_ZEND_FEED_READER_ONLINE_ENABLED', false); - -/** - * Zend_Gdata tests - * - * If the ONLINE_ENABLED property is false, only tests that can be executed with - * a mock HTTP client are run. No request is sent to the Google Gdata servers. - * If ONLINE_ENABLED is true, some tests may make requests to the remote - * servers. This does not work if you are running tests on a disconnected - * client host. Also, the tests may show as failures if the Google servers - * cannot be reached or if they do not respond for another reason. - * - * If the CLIENTLOGIN_ENABLED property below is false, the authenticated - * tests are reported Skipped in the test run. Set this property to true - * to enable tests that require ClientLogin authentication. Enter your - * Google login credentials in the EMAIL and PASSWORD properties below. - * - * Edit TestConfiguration.php, not TestConfiguration.php.dist. - * Never commit plaintext passwords to the source code repository. - * - * Note: the GData tests currently require that the TZID env variable - * be set or the timezone otherwise configured. You'll see errors from the - * tests if this is not the case. - */ -defined('TESTS_ZEND_GDATA_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED', false); - -/* - * The credentials provided here should be only for a TEST account. - * Data for various services in this account may be added to, updated, - * or deleted based upon the actions of these test accounts. - */ -defined('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL', 'example@example.com'); -defined('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD', 'password'); - -/* - * This is the ID of a blank blog. There is no need to have - * any content in this blog. Also, blogs can only be used - * several times for the purpose of these test cases before - * they must be deleted and recreated. Otherwise, the tests - * will start failing, as posts to Blogger will return a 201 Created - * response even though the entry was not posted to the blog. - * This problem is being investigated. - */ -defined('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_BLOG_ID') || define('TESTS_ZEND_GDATA_BLOG_ID', '1111111111111111111'); - -/* - * This is the key for a spreadsheet with data only in the first row of - * the spreadsheet. The strings 'a1', 'b1', 'c1', 'd1' should be in the - * corresponding cell locations. - */ -defined('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY') || define('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY', 'o01111111111111111111.1111111111111111111'); -defined('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID') || define('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID', 'default'); - -/* - * This indicates that online tests for the Google Calendar API should - * be performed. The default calendar will be used. - */ -defined('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED', false); - -/* - * This is the fully-qualified domain name for a domiain hosted using - * Google Apps. This domain must be registered with Google Apps and - * have API access enabled. This should be a TEST domain only. - */ -defined('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_GAPPS_DOMAIN') || define('TESTS_ZEND_GDATA_GAPPS_DOMAIN', 'example.com.invalid'); -defined('TESTS_ZEND_GDATA_GAPPS_EMAIL') || define('TESTS_ZEND_GDATA_GAPPS_EMAIL', 'example@example.com'); -defined('TESTS_ZEND_GDATA_GAPPS_PASSWORD') || define('TESTS_ZEND_GDATA_GAPPS_PASSWORD', 'password'); - -/* - * This indicates that online tests for the Books Search data API - * should be performed. - */ -defined('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED', false); - -/* - * This indicates that online tests for the Google Documents API should - * be performed. - */ -defined('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED', false); - -/* - * This indicates that online tests for the GData Photos API should - * be performed. - */ -defined('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED', false); /** * Zend_Loader_Autoloader multi-version support tests @@ -227,28 +116,6 @@ defined('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE') || define('TESTS_ZEND_LOCALE_FORMA * Edit TestConfiguration.php, not TestConfiguration.php.dist. */ defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') || define('TESTS_ZEND_LOCALE_BCMATH_ENABLED', true); -defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || define('TESTS_ZEND_I18N_EXTENDED_COVERAGE', true); - -/** - * Zend_Rest tests - */ -defined('TESTS_ZEND_REST_ONLINE_ENABLED') || define('TESTS_ZEND_REST_ONLINE_ENABLED', false); - - -/** - * Zend_Serializer adapter tests - * - * TESTS_ZEND_SERIALIZER_ADAPTER_WDDX_ENABLED: - * - enable wddx adapter tests - * - needs wddx and SimpleXml php extension installed - * - * TESTS_ZEND_SERIALIZER_ADAPTER_IGBINARY_ENABLED: - * - enable igbinary adapter tests - * - needs igbinary php extension installed - */ -defined('TESTS_ZEND_SERIALIZER_ADAPTER_WDDX_ENABLED') || define('TESTS_ZEND_SERIALIZER_ADAPTER_WDDX_ENABLED', false); -defined('TESTS_ZEND_SERIALIZER_ADAPTER_IGBINARY_ENABLED') || define('TESTS_ZEND_SERIALIZER_ADAPTER_IGBINARY_ENABLED', false); - /** * Zend_Uri tests @@ -261,15 +128,6 @@ defined('TESTS_ZEND_SERIALIZER_ADAPTER_IGBINARY_ENABLED') || define('TESTS_ZEND_ */ defined('TESTS_ZEND_URI_CRASH_TEST_ENABLED') || define('TESTS_ZEND_URI_CRASH_TEST_ENABLED', false); -/** - * Zend_Version tests - * - * Set ONLINE_ENABLED if you wish to run validators that require network - * connectivity. - */ -defined('TESTS_ZEND_VERSION_ONLINE_ENABLED') || define('TESTS_ZEND_VERSION_ONLINE_ENABLED', false); - - /** * Zend_Validate tests * diff --git a/tests/TestHelper.php b/tests/TestHelper.php index b8c02a71a..5fad88e83 100644 --- a/tests/TestHelper.php +++ b/tests/TestHelper.php @@ -1,4 +1,5 @@ _acl->addRole(new Zend_Acl_Role('grandparent')) @@ -965,9 +960,8 @@ public function testRoleInheritanceSupportsCheckingOnlyParents() /** * Ensures that the solution for ZF-2234 works as expected. - * - * @group ZF-2234 */ + #[PHPUnit\Framework\Attributes\Group('ZF-2234')] public function testAclInternalDFSMethodsBehaveProperly() { require_once __DIR__ . '/_files/ExtendedAclZF2234.php'; @@ -1011,9 +1005,7 @@ public function testAclInternalDFSMethodsBehaveProperly() } } - /** - * @group ZF-1721 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-1721')] public function testAclAssertionsGetProperRoleWhenInheritenceIsUsed() { $acl = $this->_loadUseCase1(); @@ -1031,9 +1023,7 @@ public function testAclAssertionsGetProperRoleWhenInheritenceIsUsed() $this->assertEquals('publisher', $assertion->lastAssertRole->getRoleId()); } - /** - * @group ZF-1722 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-1722')] public function testAclAssertionsGetOriginalIsAllowedObjects() { $acl = $this->_loadUseCase1(); @@ -1074,28 +1064,11 @@ protected function _loadUseCase1() return new Zend_Acl_UseCase1_Acl(); } - /** - * Returns an array of registered roles. - * - * @group ZF-5638 - */ - public function testGetRegisteredRoles() - { - $this->expectException(\PHPUnit\Framework\Exception::class); - $acl = $this->_acl; - $acl->addRole('developer'); - - $roles = $acl->getRegisteredRoles(); - $this->assertTrue(is_array($roles)); - $this->assertFalse(empty($roles)); - } - /** * Confirm that deleting a role after allowing access to all roles * raise undefined index error. - * - * @group ZF-5700 */ + #[PHPUnit\Framework\Attributes\Group('ZF-5700')] public function testRemovingRoleAfterItWasAllowedAccessToAllResourcesGivesError() { $acl = new Zend_Acl(); @@ -1113,12 +1086,9 @@ public function testRemovingRoleAfterItWasAllowedAccessToAllResourcesGivesError( $this->assertFalse($acl->hasRole('test0')); } - /** - * @group ZF-8039 - * - * Meant to test for the (in)existance of this notice: - * "Notice: Undefined index: allPrivileges in lib/Zend/Acl.php on line 682" - */ + #[PHPUnit\Framework\Attributes\Group('ZF-8039 +Meant to test for the (in)existance of this notice: +"Notice: Undefined index: allPrivileges in lib/Zend/Acl.php on line 682"')] public function testMethodRemoveAllowDoesNotThrowNotice() { $acl = new Zend_Acl(); @@ -1141,9 +1111,7 @@ public function testResourceObjectImplementsToString() $this->assertEquals('_fooBar_',(string) $resource); } - /** - * @group ZF-7973 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7973')] public function testAclPassesPrivilegeToAssertClass() { require_once __DIR__ . '/_files/AssertionZF7973.php'; @@ -1158,26 +1126,7 @@ public function testAclPassesPrivilegeToAssertClass() $this->assertTrue($allowed); } - /** - * @group ZF-8468 - */ - public function testGetRegisteredRolesIsDeprecated() - { - try { - $this->_acl->getRegisteredRoles(); - $this->fail('getRegisteredRoles() did not throw an exception'); - } catch (\PHPUnit\Framework\Exception) { - self::assertTrue(true); - - return; - } - - static::fail('An expected notice has not been raised'); - } - - /** - * @group ZF-8468 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-8468')] public function testgetRoles() { $this->assertEquals([],$this->_acl->getRoles()); @@ -1192,9 +1141,7 @@ public function testgetRoles() $this->assertEquals($expected, $this->_acl->getRoles()); } - /** - * @group ZF-8468 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-8468')] public function testgetResources() { $this->assertEquals([],$this->_acl->getResources()); @@ -1206,9 +1153,7 @@ public function testgetResources() $this->assertEquals($expected, $this->_acl->getResources()); } - /** - * @group ZF-9643 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-9643')] public function testRemoveAllowWithNullResourceAfterResourceSpecificRulesAppliesToAllResources() { $this->_acl->addRole('guest'); @@ -1233,9 +1178,7 @@ public function testRemoveAllowWithNullResourceAfterResourceSpecificRulesApplies $this->assertTrue($this->_acl->isAllowed('guest', 'newsletter', 'read')); } - /** - * @group ZF-9643 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-9643')] public function testRemoveDenyWithNullResourceAfterResourceSpecificRulesAppliesToAllResources() { $this->_acl->addRole('guest'); @@ -1262,9 +1205,7 @@ public function testRemoveDenyWithNullResourceAfterResourceSpecificRulesAppliesT $this->assertFalse($this->_acl->isAllowed('guest', 'newsletter', 'read')); } - /** - * @group ZF-10649 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-10649')] public function testAllowAndDenyWithNullForResourcesWillApplyToAllResources() { $this->_acl->addRole('guest'); diff --git a/tests/Zend/AllTests/StreamWrapper/PhpInput.php b/tests/Zend/AllTests/StreamWrapper/PhpInput.php index a65437eec..92ab104ae 100644 --- a/tests/Zend/AllTests/StreamWrapper/PhpInput.php +++ b/tests/Zend/AllTests/StreamWrapper/PhpInput.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -99,11 +93,8 @@ public function testConstructorShouldSetOptionsWhenProvided() $this->assertEquals($options, $application->getOptions()); } - /** - * @group GH-564 - * - * @depends testConstructorInstantiatesAutoloader - */ + #[PHPUnit\Framework\Attributes\Depends('testConstructorInstantiatesAutoloader')] + #[PHPUnit\Framework\Attributes\Group('GH-564')] public function testConstructorRespectsSuppressFileNotFoundWarningFlag() { $application = new Zend_Application('testing'); @@ -249,7 +240,7 @@ public function testPassingArrayBootstrapOptionShouldRegisterBootstrapBasedOnPat public function testPassingArrayBootstrapWithoutPathOptionShouldRaiseException() { - $this->expectException(\Zend_Application_Exception::class); + $this->expectException(Zend_Application_Exception::class); $this->application->setOptions([ 'bootstrap' => [ 'class' => 'ZfAppBootstrap', @@ -260,7 +251,7 @@ public function testPassingArrayBootstrapWithoutPathOptionShouldRaiseException() public function testPassingInvalidBootstrapOptionShouldRaiseException() { - $this->expectException(\Zend_Application_Exception::class); + $this->expectException(Zend_Application_Exception::class); $this->application->setOptions([ 'bootstrap' => new stdClass(), ]); @@ -269,7 +260,7 @@ public function testPassingInvalidBootstrapOptionShouldRaiseException() public function testPassingInvalidOptionsArgumentToConstructorShouldRaiseException() { - $this->expectException(\Zend_Application_Exception::class); + $this->expectException(Zend_Application_Exception::class); $application = new Zend_Application('testing', new stdClass()); } @@ -291,18 +282,14 @@ public function testPassingStringIncConfigPathOptionToConstructorShouldLoadOptio $this->assertTrue($application->hasOption('foo')); } - /** - * @group ZF-10898 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-10898')] public function testPassingStringIniDistfileConfigPathOptionToConstructorShouldLoadOptions() { $application = new Zend_Application('testing', __DIR__ . '/_files/appconfig.ini.dist'); $this->assertTrue($application->hasOption('foo')); } - /** - * @group ZF-10898 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-10898')] public function testPassingArrayOptionsWithConfigKeyDistfileShouldLoadOptions() { $application = new Zend_Application('testing', ['bar' => 'baz', 'config' => __DIR__ . '/_files/appconfig.ini.dist']); @@ -319,9 +306,8 @@ public function testPassingArrayOptionsWithConfigKeyShouldLoadOptions() /** * This was changed to have the passed in array always overwrite the config file. - * - * @group ZF-6811 */ + #[PHPUnit\Framework\Attributes\Group('ZF-6811')] public function testPassingArrayOptionsWithConfigKeyShouldLoadOptionsAndNotOverride() { $application = new Zend_Application('testing', ['foo' => 'baz', 'config' => __DIR__ . '/_files/appconfig.inc']); @@ -330,7 +316,7 @@ public function testPassingArrayOptionsWithConfigKeyShouldLoadOptionsAndNotOverr public function testPassingInvalidStringOptionToConstructorShouldRaiseException() { - $this->expectException(\Zend_Application_Exception::class); + $this->expectException(Zend_Application_Exception::class); $application = new Zend_Application('testing', __DIR__ . '/_files/appconfig'); } @@ -356,7 +342,7 @@ public function testBootstrapImplementsFluentInterface() public function testApplicationShouldRaiseExceptionIfBootstrapFileDoesNotContainBootstrapClass() { - $this->expectException(\Zend_Application_Exception::class); + $this->expectException(Zend_Application_Exception::class); $this->application->setOptions([ 'bootstrap' => [ 'path' => __DIR__ . '/_files/ZfAppNoBootstrap.php', @@ -368,7 +354,7 @@ public function testApplicationShouldRaiseExceptionIfBootstrapFileDoesNotContain public function testApplicationShouldRaiseExceptionWhenBootstrapClassNotOfCorrectType() { - $this->expectException(\Zend_Application_Exception::class); + $this->expectException(Zend_Application_Exception::class); $this->application->setOptions([ 'bootstrap' => [ 'path' => __DIR__ . '/_files/ZfAppBadBootstrap.php', @@ -402,9 +388,7 @@ public function testOptionsShouldRetainOriginalCase() $this->assertSame(array_keys($options), array_keys($setOptions)); } - /** - * @group ZF-6679 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6679')] public function testSetOptionsShouldProperlyMergeTwoConfigFileOptions() { $application = new Zend_Application( @@ -435,9 +419,7 @@ public function testPassingZfVersionAutoloaderInformationConfiguresAutoloader() $this->assertStringContainsString($latest, $actual); } - /** - * @group ZF-7742 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7742')] public function testHasOptionShouldTreatOptionKeysAsCaseInsensitive() { $application = new Zend_Application('production', [ @@ -446,9 +428,7 @@ public function testHasOptionShouldTreatOptionKeysAsCaseInsensitive() $this->assertTrue($application->hasOption('FooBar')); } - /** - * @group ZF-7742 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7742')] public function testGetOptionShouldTreatOptionKeysAsCaseInsensitive() { $application = new Zend_Application('production', [ @@ -457,9 +437,7 @@ public function testGetOptionShouldTreatOptionKeysAsCaseInsensitive() $this->assertEquals('baz', $application->getOption('FooBar')); } - /** - * @group ZF-6618 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6618')] public function testCanExecuteBoostrapResourceViaApplicationInstanceBootstrapMethod() { $application = new Zend_Application('testing', [ diff --git a/tests/Zend/Application/Bootstrap/BootstrapAbstractTest.php b/tests/Zend/Application/Bootstrap/BootstrapAbstractTest.php index b5339bc9f..29f62dbe1 100644 --- a/tests/Zend/Application/Bootstrap/BootstrapAbstractTest.php +++ b/tests/Zend/Application/Bootstrap/BootstrapAbstractTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -130,7 +124,7 @@ public function testConstructorShouldAllowPassingAnotherBootstrapObject() public function testConstructorShouldRaiseExceptionForInvalidApplicationArgument() { - $this->expectException(\Zend_Application_Bootstrap_Exception::class); + $this->expectException(Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap(new stdClass()); } @@ -146,9 +140,7 @@ public function testSettingOptionsShouldProxyToInternalSetters() $this->assertEquals('foo', $bootstrap->getArbitrary()); } - /** - * @group ZF-6459 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6459')] public function testCallingSetOptionsMultipleTimesShouldMergeOptionsRecursively() { require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; @@ -250,7 +242,7 @@ public function testInternalInitializersShouldRegisterResourceNames() public function testRegisterPluginResourceShouldThrowExceptionForInvalidResourceType() { - $this->expectException(\Zend_Application_Bootstrap_Exception::class); + $this->expectException(Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->registerPluginResource([]); @@ -284,7 +276,7 @@ public function testShouldAllowRegisteringPluginResourceUsingNameOnly() $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->registerPluginResource('view'); $test = $bootstrap->getPluginResource('view'); - $this->assertEquals(\Zend_Application_Resource_View::class, $test::class); + $this->assertEquals(Zend_Application_Resource_View::class, $test::class); } public function testShouldAllowUnregisteringPluginResourcesUsingConcreteInstance() @@ -299,7 +291,7 @@ public function testShouldAllowUnregisteringPluginResourcesUsingConcreteInstance public function testAttemptingToUnregisterPluginResourcesUsingInvalidResourceTypeShouldThrowException() { - $this->expectException(\Zend_Application_Bootstrap_Exception::class); + $this->expectException(Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->registerPluginResource('view'); @@ -376,9 +368,7 @@ public function testBootstrappingShouldOnlyExecuteEachInitializerOnce() $this->assertEquals(1, $bootstrap->fooExecuted); } - /** - * @group ZF-7955 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7955')] public function testBootstrappingIsCaseInsensitive() { require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; @@ -422,7 +412,7 @@ public function testPassingNoValuesToBootstrapExecutesAllResources() public function testPassingInvalidResourceArgumentToBootstrapShouldThrowException() { - $this->expectException(\Zend_Application_Bootstrap_Exception::class); + $this->expectException(Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->bootstrap(new stdClass()); @@ -430,7 +420,7 @@ public function testPassingInvalidResourceArgumentToBootstrapShouldThrowExceptio public function testPassingUnknownResourceToBootstrapShouldThrowException() { - $this->expectException(\Zend_Application_Bootstrap_Exception::class); + $this->expectException(Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->bootstrap('bazbat'); @@ -446,7 +436,7 @@ public function testCallShouldOverloadToBootstrap() public function testCallShouldThrowExceptionForInvalidMethodCall() { - $this->expectException(\Zend_Application_Bootstrap_Exception::class); + $this->expectException(Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; $bootstrap = new ZfAppBootstrap($this->application); $bootstrap->initFoo(); @@ -454,7 +444,7 @@ public function testCallShouldThrowExceptionForInvalidMethodCall() public function testDependencyTrackingShouldDetectCircularDependencies() { - $this->expectException(\Zend_Application_Bootstrap_Exception::class); + $this->expectException(Zend_Application_Bootstrap_Exception::class); require_once __DIR__ . '/../_files/BootstrapBaseCircularDependency.php'; $bootstrap = new BootstrapBaseCircularDependency($this->application); $bootstrap->bootstrap(); @@ -525,9 +515,7 @@ public function testMagicMethodsForPluginResources() $this->assertEquals('Baz', $resource->baz); } - /** - * @group ZF-6543 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6543')] public function testPassingPluginResourcesByFullClassNameWithMatchingPluginPathShouldRegisterAsShortName() { $this->application->setOptions([ @@ -542,9 +530,7 @@ public function testPassingPluginResourcesByFullClassNameWithMatchingPluginPathS $this->assertTrue($bootstrap->hasPluginResource('View'), var_export(array_keys($bootstrap->getPluginResources()), 1)); } - /** - * @group ZF-6543 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6543')] public function testPassingFullViewClassNameNotMatchingARegisteredPrefixShouldRegisterAsTheClassName() { $this->application->setOptions([ @@ -556,9 +542,7 @@ public function testPassingFullViewClassNameNotMatchingARegisteredPrefixShouldRe $this->assertTrue($bootstrap->hasPluginResource('Zend_Application_Bootstrap_BootstrapAbstractTest_View')); } - /** - * @group ZF-6543 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6543')] public function testPassingFullViewClassNameNotMatchingARegisteredPrefixShouldReturnAppropriateResource() { $this->application->setOptions([ @@ -572,9 +556,7 @@ public function testPassingFullViewClassNameNotMatchingARegisteredPrefixShouldRe $this->assertTrue($resource instanceof Zend_Application_Bootstrap_BootstrapAbstractTest_View, var_export(array_keys($bootstrap->getPluginResources()), 1)); } - /** - * @group ZF-6543 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6543')] public function testCanMixAndMatchPluginResourcesAndFullClassNames() { $this->application->setOptions([ @@ -593,9 +575,7 @@ public function testCanMixAndMatchPluginResourcesAndFullClassNames() $this->assertTrue($resource2 instanceof Zend_View); } - /** - * @group ZF-6543 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6543')] public function testPluginClassesDefiningExplicitTypeWillBeRegisteredWithThatValue() { $this->application->setOptions([ @@ -614,9 +594,7 @@ public function testPluginClassesDefiningExplicitTypeWillBeRegisteredWithThatVal $this->assertTrue($resource2 instanceof Zend_Layout); } - /** - * @group ZF-6471 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6471')] public function testBootstrapShouldPassItselfToResourcePluginConstructor() { $this->application->setOptions([ @@ -632,9 +610,7 @@ public function testBootstrapShouldPassItselfToResourcePluginConstructor() $this->assertTrue($resource->bootstrapSetInConstructor, var_export(get_object_vars($resource), 1)); } - /** - * @group ZF-6591 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6591')] public function testRequestingPluginsByShortNameShouldNotRaiseFatalErrors() { $this->autoloader->setFallbackAutoloader(true) @@ -651,9 +627,7 @@ public function testRequestingPluginsByShortNameShouldNotRaiseFatalErrors() $this->assertTrue(false === $this->error, $this->error); } - /** - * @group ZF-7550 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7550')] public function testRequestingPluginsByAutoloadableClassNameShouldNotRaiseFatalErrors() { // Using namesapce 'zabt' to prevent conflict with Zend namespace @@ -673,9 +647,7 @@ public function testRequestingPluginsByAutoloadableClassNameShouldNotRaiseFatalE self::assertTrue(true); } - /** - * @group ZF-7690 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7690')] public function testCallingSetOptionsMultipleTimesShouldUpdateOptionKeys() { $this->application->setOptions([ @@ -694,19 +666,15 @@ public function testCallingSetOptionsMultipleTimesShouldUpdateOptionKeys() $this->assertEquals($expected, $actual); } - /** - * @group ZF-9110 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-9110')] public function testPassingSameBootstrapAsApplicationShouldNotCauseRecursion() { - $this->expectException(\Zend_Application_Bootstrap_Exception::class); + $this->expectException(Zend_Application_Bootstrap_Exception::class); $bootstrap = new Zend_Application_Bootstrap_Bootstrap($this->application); $bootstrap->setApplication($bootstrap); } - /** - * @group ZF-7696 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7696')] public function testUsingFallbackAutoloaderWithModulesShouldNotResultInFrontcontrollerNotFoundWarning() { require_once __DIR__ . '/../_files/Zf7696Bootstrap.php'; @@ -722,9 +690,7 @@ public function testUsingFallbackAutoloaderWithModulesShouldNotResultInFrontcont self::assertTrue(true); } - /** - * @group ZF-10199 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-10199')] public function testHasOptionShouldTreatOptionKeysAsCaseInsensitive() { $application = $this->application; @@ -734,9 +700,7 @@ public function testHasOptionShouldTreatOptionKeysAsCaseInsensitive() $this->assertTrue($application->getBootstrap()->hasOption('FooBar')); } - /** - * @group ZF-10199 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-10199')] public function testGetOptionShouldTreatOptionKeysAsCaseInsensitive() { $application = $this->application; @@ -746,10 +710,8 @@ public function testGetOptionShouldTreatOptionKeysAsCaseInsensitive() $this->assertEquals('baz', $application->getBootstrap()->getOption('FooBar')); } - /** - * @group ZF-8751 - * @group ZF-10842 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-8751')] + #[PHPUnit\Framework\Attributes\Group('ZF-10842')] public function testPathDefaultZendXToPluginsResources() { $application = $this->application diff --git a/tests/Zend/Application/Bootstrap/BootstrapTest.php b/tests/Zend/Application/Bootstrap/BootstrapTest.php index 99eedc67e..7a0ee6157 100644 --- a/tests/Zend/Application/Bootstrap/BootstrapTest.php +++ b/tests/Zend/Application/Bootstrap/BootstrapTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -88,7 +82,7 @@ public function testFrontControllerResourcePluginShouldBeRegisteredByDefault() public function testRunShouldRaiseExceptionIfNoControllerDirectoryRegisteredWithFrontController() { - $this->expectException(\Zend_Application_Bootstrap_Exception::class); + $this->expectException(Zend_Application_Bootstrap_Exception::class); $this->bootstrap->bootstrap(); $this->bootstrap->run(); } @@ -113,17 +107,13 @@ public function testRunShouldDispatchFrontController() $this->assertTrue($this->bootstrap->getContainer()->zfappbootstrap); } - /** - * @group ZF-8496 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-8496')] public function testBootstrapModuleAutoloaderShouldNotBeInitializedByDefault() { $this->assertFalse($this->bootstrap->getResourceLoader() instanceof Zend_Application_Module_Autoloader); } - /** - * @group ZF-8496 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-8496')] public function testBootstrapShouldInitializeModuleAutoloaderWhenNamespaceSpecified() { $application = new Zend_Application('testing', [ @@ -137,9 +127,7 @@ public function testBootstrapShouldInitializeModuleAutoloaderWhenNamespaceSpecif $this->assertEquals('Application', $al->getNamespace()); } - /** - * @group ZF-8496 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-8496')] public function testBootstrapAutoloaderNamespaceShouldBeConfigurable() { $application = new Zend_Application('testing', [ @@ -152,9 +140,7 @@ public function testBootstrapAutoloaderNamespaceShouldBeConfigurable() $this->assertEquals('Default', $al->getNamespace()); } - /** - * @group ZF-9435 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-9435')] public function testBootstrapShouldInitializeModuleAutoloaderWhenNamespaceSpecifiedAsEmpty() { $application = new Zend_Application( @@ -175,9 +161,7 @@ public function testBootstrapShouldInitializeModuleAutoloaderWhenNamespaceSpecif $this->assertEquals('', $al->getNamespace()); } - /** - * @group ZF-7367 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7367')] public function testBootstrapRunMethodShouldReturnResponseIfFlagEnabled() { $this->bootstrap->setOptions([ diff --git a/tests/Zend/Application/Module/AutoloaderTest.php b/tests/Zend/Application/Module/AutoloaderTest.php index ca580bcfe..cca6c189e 100644 --- a/tests/Zend/Application/Module/AutoloaderTest.php +++ b/tests/Zend/Application/Module/AutoloaderTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders diff --git a/tests/Zend/Application/Module/BootstrapTest.php b/tests/Zend/Application/Module/BootstrapTest.php index 4204be0ff..4acc3957f 100644 --- a/tests/Zend/Application/Module/BootstrapTest.php +++ b/tests/Zend/Application/Module/BootstrapTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -114,9 +108,7 @@ public function testShouldPullModuleNamespacedOptionsWhenPresent() $this->assertEquals('baz', $bootstrap->foo); } - /** - * @group ZF-6545 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6545')] public function testFrontControllerPluginResourceShouldBeRegistered() { require_once __DIR__ . '/../_files/ZfModuleBootstrap.php'; @@ -124,9 +116,7 @@ public function testFrontControllerPluginResourceShouldBeRegistered() $this->assertTrue($bootstrap->hasPluginResource('FrontController')); } - /** - * @group ZF-6545 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6545')] public function testFrontControllerStateRemainsSameIfNoOptionsPassedToModuleBootstrap() { require_once __DIR__ . '/../_files/ZfModuleBootstrap.php'; @@ -158,9 +148,7 @@ public function testFrontControllerStateRemainsSameIfNoOptionsPassedToModuleBoot $this->assertEquals(__DIR__, $test->getControllerDirectory('default')); } - /** - * @group ZF-6545 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6545')] public function testModuleBootstrapsShouldNotAcceptModuleResourceInOrderToPreventRecursion() { require_once __DIR__ . '/../_files/ZfModuleBootstrap.php'; @@ -190,9 +178,7 @@ public function testModuleBootstrapsShouldNotAcceptModuleResourceInOrderToPreven } } - /** - * @group ZF-6567 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6567')] public function testModuleBootstrapShouldInheritApplicationBootstrapPluginPaths() { require_once __DIR__ . '/../_files/ZfModuleBootstrap.php'; diff --git a/tests/Zend/Application/Resource/CacheManagerTest.php b/tests/Zend/Application/Resource/CacheManagerTest.php deleted file mode 100644 index 45102894d..000000000 --- a/tests/Zend/Application/Resource/CacheManagerTest.php +++ /dev/null @@ -1,237 +0,0 @@ -run($suite); - } - - public function setUp(): void - { - // Store original autoloaders - $this->loaders = spl_autoload_functions(); - if (!is_array($this->loaders)) { - // spl_autoload_functions does not return empty array when no - // autoloaders registered... - $this->loaders = []; - } - - Zend_Loader_Autoloader::resetInstance(); - $this->autoloader = Zend_Loader_Autoloader::getInstance(); - - $this->application = new Zend_Application('testing'); - - require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; - $this->bootstrap = new ZfAppBootstrap($this->application); - } - - public function tearDown(): void - { - // Restore original autoloaders - $loaders = spl_autoload_functions(); - foreach ($loaders as $loader) { - spl_autoload_unregister($loader); - } - - foreach ($this->loaders as $loader) { - spl_autoload_register($loader); - } - - Zend_Controller_Front::getInstance()->resetInstance(); - - // Reset autoloader instance so it doesn't affect other tests - Zend_Loader_Autoloader::resetInstance(); - } - - public function testInitializationCreatesCacheManagerInstance() - { - $resource = new Zend_Application_Resource_Cachemanager([]); - $resource->init(); - $this->assertTrue($resource->getCachemanager() instanceof Zend_Cache_Manager); - } - - public function testShouldReturnCacheManagerWhenComplete() - { - $resource = new Zend_Application_Resource_Cachemanager([]); - $manager = $resource->init(); - $this->assertTrue($manager instanceof Zend_Cache_Manager); - } - - public function testShouldMergeConfigsIfOptionsPassedForDefaultCacheTemplate() - { - $options = [ - 'page' => [ - 'backend' => [ - 'options' => [ - 'cache_dir' => '/foo', - ], - ], - ], - ]; - $resource = new Zend_Application_Resource_Cachemanager($options); - $manager = $resource->init(); - $cacheTemplate = $manager->getCacheTemplate('page'); - $this->assertEquals('/foo', $cacheTemplate['backend']['options']['cache_dir']); - } - - public function testShouldCreateNewCacheTemplateIfConfigNotMatchesADefaultTemplate() - { - $options = [ - 'foo' => [ - 'backend' => [ - 'options' => [ - 'cache_dir' => '/foo', - ], - ], - ], - ]; - $resource = new Zend_Application_Resource_Cachemanager($options); - $manager = $resource->init(); - $cacheTemplate = $manager->getCacheTemplate('foo'); - $this->assertSame($options['foo'], $cacheTemplate); - } - - public function testShouldNotMeddleWithFrontendOrBackendCapitalisation() - { - $options = [ - 'foo' => [ - 'backend' => [ - 'name' => 'BlackHole', - ], - ], - ]; - $resource = new Zend_Application_Resource_Cachemanager($options); - $manager = $resource->init(); - $cacheTemplate = $manager->getCacheTemplate('foo'); - $this->assertEquals('BlackHole', $cacheTemplate['backend']['name']); - } - - public function testEmptyBackendOptionsShouldNotResultInError() - { - $options = [ - 'foo' => [ - 'frontend' => [ - 'name' => 'Core', - 'options' => [ - 'lifetime' => 7200, - ], - ], - 'backend' => [ - 'name' => 'black.hole', - ], - ], - ]; - $resource = new Zend_Application_Resource_Cachemanager($options); - $manager = $resource->init(); - $cache = $manager->getCache('foo'); - $this->assertTrue($cache instanceof Zend_Cache_Core); - } - - /** - * @group ZF-9738 - */ - public function testZendServer() - { - if (!function_exists('zend_disk_cache_store')) { - $this->markTestSkipped('ZendServer is required for this test'); - } - - $options = [ - 'foo' => [ - 'frontend' => [ - 'name' => 'Core', - 'options' => [ - 'lifetime' => 7200, - ], - ], - 'backend' => [ - 'name' => 'ZendServer_Disk', - ], - ], - ]; - $resource = new Zend_Application_Resource_Cachemanager($options); - $manager = $resource->init(); - $cache = $manager->getCache('foo')->getBackend(); - $this->assertTrue($cache instanceof Zend_Cache_Backend_ZendServer_Disk); - } - - /** - * @group ZF-9737 - */ - public function testCustomFrontendBackendNaming() - { - $options = [ - 'zf9737' => [ - 'frontend' => [ - 'name' => 'custom-naming', - 'customFrontendNaming' => false, ], - 'backend' => ['name' => 'Zend_Cache_Backend_Custom_Naming', - 'customBackendNaming' => true, ], - 'frontendBackendAutoload' => true, ], - ]; - - $resource = new Zend_Application_Resource_Cachemanager($options); - $manager = $resource->init(); - $cache = $manager->getCache('zf9737'); - $this->assertTrue($cache->getBackend() instanceof Zend_Cache_Backend_Custom_Naming); - $this->assertTrue($cache instanceof Zend_Cache_Frontend_CustomNaming); - } -} - -class Zend_Cache_Backend_Custom_Naming extends Zend_Cache_Backend -{ -} - -class Zend_Cache_Frontend_CustomNaming extends Zend_Cache_Core -{ -} diff --git a/tests/Zend/Application/Resource/FrontcontrollerTest.php b/tests/Zend/Application/Resource/FrontcontrollerTest.php index a1a2bbbb6..972074d0a 100644 --- a/tests/Zend/Application/Resource/FrontcontrollerTest.php +++ b/tests/Zend/Application/Resource/FrontcontrollerTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -80,7 +74,6 @@ public function tearDown(): void public function testInitializationCreatesFrontControllerInstance() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([]); $resource->init(); $this->assertTrue($resource->getFrontController() instanceof Zend_Controller_Front); @@ -88,7 +81,6 @@ public function testInitializationCreatesFrontControllerInstance() public function testInitializationPushesFrontControllerToBootstrapWhenPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([]); $resource->setBootstrap($this->bootstrap); $resource->init(); @@ -97,7 +89,6 @@ public function testInitializationPushesFrontControllerToBootstrapWhenPresent() public function testShouldSetControllerDirectoryWhenStringOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'controllerDirectory' => __DIR__, ]); @@ -109,7 +100,6 @@ public function testShouldSetControllerDirectoryWhenStringOptionPresent() public function testShouldSetControllerDirectoryWhenArrayOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'controllerDirectory' => [ 'foo' => __DIR__, @@ -121,12 +111,9 @@ public function testShouldSetControllerDirectoryWhenArrayOptionPresent() $this->assertEquals(__DIR__, $dir); } - /** - * @group ZF-6458 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6458')] public function testAllControllerDirectoriesShouldBeSetWhenArrayPassedToControllerDirectoryOption() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'controllerDirectory' => [ 'foo' => __DIR__, @@ -144,7 +131,6 @@ public function testAllControllerDirectoriesShouldBeSetWhenArrayPassedToControll public function testShouldSetModuleControllerDirectoryNameWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'moduleControllerDirectoryName' => 'foo', ]); @@ -156,10 +142,9 @@ public function testShouldSetModuleControllerDirectoryNameWhenOptionPresent() public function testShouldSetModuleDirectoryWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'moduleDirectory' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR . 'modules', + . '_files' . DIRECTORY_SEPARATOR . 'modules', ]); $resource->init(); $front = $resource->getFrontController(); @@ -187,15 +172,12 @@ public function testShouldSetModuleDirectoryWhenOptionPresent() $this->assertEquals($expected, $dir); } - /** - * @group ZF-9258 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-9258')] public function testShouldSetMultipleModuleDirectorysWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'moduleDirectory' => [__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR . 'modules', + . '_files' . DIRECTORY_SEPARATOR . 'modules', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'more_modules', ], ]); @@ -233,7 +215,6 @@ public function testShouldSetMultipleModuleDirectorysWhenOptionPresent() public function testShouldSetDefaultControllerNameWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'defaultControllerName' => 'foo', ]); @@ -245,7 +226,6 @@ public function testShouldSetDefaultControllerNameWhenOptionPresent() public function testShouldSetDefaultActionWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'defaultAction' => 'foo', ]); @@ -257,7 +237,6 @@ public function testShouldSetDefaultActionWhenOptionPresent() public function testShouldSetDefaultModuleWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'defaultModule' => 'foo', ]); @@ -269,7 +248,6 @@ public function testShouldSetDefaultModuleWhenOptionPresent() public function testShouldSetBaseUrlWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'baseUrl' => '/foo', ]); @@ -285,7 +263,6 @@ public function testShouldSetParamsWhenOptionPresent() 'foo' => 'bar', 'bar' => 'baz', ]; - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'params' => $params, ]); @@ -298,9 +275,8 @@ public function testShouldSetParamsWhenOptionPresent() public function testShouldInstantiateAndRegisterPluginsWhenOptionPassed() { $plugins = [ - \Zend_Controller_Plugin_ActionStack::class, + Zend_Controller_Plugin_ActionStack::class, ]; - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'plugins' => $plugins, ]); @@ -313,7 +289,6 @@ public function testShouldInstantiateAndRegisterPluginsWhenOptionPassed() public function testShouldReturnFrontControllerWhenComplete() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'controllerDirectory' => __DIR__, ]); @@ -323,7 +298,6 @@ public function testShouldReturnFrontControllerWhenComplete() public function testNoBaseUrlShouldBeSetIfEmptyBaseUrlProvidedInOptions() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'baseurl' => '', ]); @@ -332,23 +306,21 @@ public function testNoBaseUrlShouldBeSetIfEmptyBaseUrlProvidedInOptions() $this->assertNull($front->getBaseUrl()); } - /** - * @group ZF-9044 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-9044')] public function testSettingOfRegisterPluginIndexActuallyWorks() { $plugins = [ - ['class' => \Zend_Controller_Plugin_ErrorHandler::class, + ['class' => Zend_Controller_Plugin_ErrorHandler::class, 'stackindex' => 10, ], - \Zend_Controller_Plugin_ActionStack::class, - ['class' => \Zend_Controller_Plugin_PutHandler::class, + Zend_Controller_Plugin_ActionStack::class, + ['class' => Zend_Controller_Plugin_PutHandler::class, 'stackIndex' => 5, ], ]; $expected = [ - 1 => \Zend_Controller_Plugin_ActionStack::class, - 5 => \Zend_Controller_Plugin_PutHandler::class, - 10 => \Zend_Controller_Plugin_ErrorHandler::class, + 1 => Zend_Controller_Plugin_ActionStack::class, + 5 => Zend_Controller_Plugin_PutHandler::class, + 10 => Zend_Controller_Plugin_ErrorHandler::class, ]; $resource = new Zend_Application_Resource_Frontcontroller([ @@ -365,12 +337,9 @@ public function testSettingOfRegisterPluginIndexActuallyWorks() } } - /** - * @group ZF-7367 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7367')] public function testPassingReturnResponseFlagShouldAlterFrontControllerStatus() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'returnresponse' => true, ]); @@ -379,12 +348,9 @@ public function testPassingReturnResponseFlagShouldAlterFrontControllerStatus() $this->assertTrue($front->returnResponse()); } - /** - * @group ZF-9724 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-9724')] public function testShouldSetDispatcherFromConfiguration() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'dispatcher' => [ 'class' => 'ZF9724_Dispatcher', @@ -400,7 +366,6 @@ public function testShouldSetDispatcherFromConfiguration() } } -require_once 'Zend/Controller/Dispatcher/Standard.php'; class ZF9724_Dispatcher extends Zend_Controller_Dispatcher_Standard { } diff --git a/tests/Zend/Application/Resource/LayoutTest.php b/tests/Zend/Application/Resource/LayoutTest.php index 4f1b4bccc..6edbedcc1 100644 --- a/tests/Zend/Application/Resource/LayoutTest.php +++ b/tests/Zend/Application/Resource/LayoutTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders diff --git a/tests/Zend/Application/Resource/LocaleTest.php b/tests/Zend/Application/Resource/LocaleTest.php index faf806324..2ba77ba60 100644 --- a/tests/Zend/Application/Resource/LocaleTest.php +++ b/tests/Zend/Application/Resource/LocaleTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -118,60 +112,6 @@ public function testOptionsPassedToResourceAreUsedToSetLocaleState1() // This test will fail if your configured locale is kok_IN $this->assertEquals('kok_IN', $locale->__toString()); - $this->assertSame(Zend_Registry::get(\Zend_Locale::class), $locale); - } - - /** - * @group ZF-7058 - */ - public function testSetCache() - { - $cache = Zend_Cache::factory('Core', 'Black Hole', [ - 'lifetime' => 120, - 'automatic_serialization' => true, - ]); - - $config = [ - 'default' => 'fr_FR', - 'cache' => $cache, - ]; - $resource = new Zend_Application_Resource_Locale($config); - $resource->init(); - $backend = Zend_Locale::getCache()->getBackend(); - $this->assertTrue($backend instanceof Zend_Cache_Backend_BlackHole); - Zend_Locale::removeCache(); - } - - /** - * @group ZF-7058 - */ - public function testSetCacheFromCacheManager() - { - $configCache = [ - 'memory' => [ - 'frontend' => [ - 'name' => 'Core', - 'options' => [ - 'lifetime' => 120, - 'automatic_serialization' => true, - ], - ], - 'backend' => [ - 'name' => 'Black Hole', - ], - ], - ]; - $this->bootstrap->registerPluginResource('cachemanager', $configCache); - $this->assertFalse(Zend_Locale::hasCache()); - - $config = [ - 'bootstrap' => $this->bootstrap, - 'cache' => 'memory', - ]; - $resource = new Zend_Application_Resource_Locale($config); - $resource->init(); - - $this->assertTrue(Zend_Locale::hasCache()); - Zend_Locale::removeCache(); + $this->assertSame(Zend_Registry::get(Zend_Locale::class), $locale); } } diff --git a/tests/Zend/Application/Resource/ModulesTest.php b/tests/Zend/Application/Resource/ModulesTest.php index 483a44473..c0ac2dd67 100644 --- a/tests/Zend/Application/Resource/ModulesTest.php +++ b/tests/Zend/Application/Resource/ModulesTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -87,10 +81,8 @@ public function testInitializationTriggersNothingIfNoModulesRegistered() $this->assertFalse(isset($this->bootstrap->bar)); } - /** - * @group ZF-6803 - * @group ZF-7158 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6803')] + #[PHPUnit\Framework\Attributes\Group('ZF-7158')] public function testInitializationTriggersDefaultModuleBootstrapWhenDiffersFromApplicationBootstrap() { require_once 'Zend/Application/Resource/Modules.php'; @@ -118,10 +110,8 @@ public function testInitializationShouldTriggerModuleBootstrapsWhenTheyExist() $this->assertTrue($this->bootstrap->bar, 'bar failed'); } - /** - * @group ZF-6803 - * @group ZF-7158 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6803')] + #[PHPUnit\Framework\Attributes\Group('ZF-7158')] public function testInitializationShouldSkipModulesWithoutBootstraps() { require_once 'Zend/Application/Resource/Modules.php'; @@ -140,10 +130,8 @@ public function testInitializationShouldSkipModulesWithoutBootstraps() $this->assertArrayHasKey('default', (array) $bootstraps); } - /** - * @group ZF-6803 - * @group ZF-7158 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6803')] + #[PHPUnit\Framework\Attributes\Group('ZF-7158')] public function testShouldReturnExecutedBootstrapsWhenComplete() { require_once 'Zend/Application/Resource/Modules.php'; @@ -174,9 +162,7 @@ public function testBootstrapBootstrapsIsOwnMethod() $this->assertEquals(3, count((array) $bootstraps)); } - /** - * @group ZF-11548 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-11548')] public function testGetExecutedBootstrapsShouldReturnArrayObject() { require_once 'Zend/Application/Resource/Modules.php'; @@ -192,7 +178,6 @@ public function testGetExecutedBootstrapsShouldReturnArrayObject() } } -require_once 'Zend/Application/Resource/Modules.php'; class ZendTest_Application_Resource_ModulesHalf extends Zend_Application_Resource_Modules { protected function bootstrapBootstraps($bootstraps) diff --git a/tests/Zend/Application/Resource/NavigationTest.php b/tests/Zend/Application/Resource/NavigationTest.php index 623846713..ed4a96c8d 100644 --- a/tests/Zend/Application/Resource/NavigationTest.php +++ b/tests/Zend/Application/Resource/NavigationTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -128,9 +122,7 @@ public function testContainerIsStoredInRegistry() $this->assertEquals($number,1); } - /** - * @group ZF-6747 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6747')] public function testViewMethodIsUsedWhenAvailableInsteadOfResourcePlugin() { require_once '_files/ZfAppBootstrapCustomView.php'; @@ -142,9 +134,7 @@ public function testViewMethodIsUsedWhenAvailableInsteadOfResourcePlugin() $this->assertEquals($view->setInMethodByTest,true); } - /** - * @group ZF-10959 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-10959')] public function testDefaultPageTypeIsSet() { $this->bootstrap->registerPluginResource('view'); @@ -168,9 +158,7 @@ public function testDefaultPageTypeIsSet() $this->bootstrap->unregisterPluginResource('view'); } - /** - * @group ZF-7461 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-7461')] public function testRegistryIsUsedWhenNumericRegistryValueIsGiven() { // Register view for cases where registry should/is not (be) used diff --git a/tests/Zend/Application/Resource/ResourceAbstractTest.php b/tests/Zend/Application/Resource/ResourceAbstractTest.php index 2acd0a920..4ac1e9609 100644 --- a/tests/Zend/Application/Resource/ResourceAbstractTest.php +++ b/tests/Zend/Application/Resource/ResourceAbstractTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -150,9 +144,7 @@ public function testConstructorAcceptsZendConfigObject() $this->assertEquals($options, $resource->getOptions()); } - /** - * @group ZF-6593 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-6593')] public function testSetOptionsShouldRemoveBootstrapOptionWhenPassed() { require_once __DIR__ . '/../_files/resources/Foo.php'; @@ -165,9 +157,7 @@ public function testSetOptionsShouldRemoveBootstrapOptionWhenPassed() $this->assertNotContains('bootstrap', array_keys($options)); } - /** - * @group ZF-8520 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-8520')] public function testFirstResourceOptionShouldNotBeDropped() { require_once __DIR__ . '/../_files/resources/Foo.php'; diff --git a/tests/Zend/Application/Resource/RouterTest.php b/tests/Zend/Application/Resource/RouterTest.php index 04e9c5731..b04367e67 100644 --- a/tests/Zend/Application/Resource/RouterTest.php +++ b/tests/Zend/Application/Resource/RouterTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders diff --git a/tests/Zend/Application/Resource/SessionTest.php b/tests/Zend/Application/Resource/SessionTest.php index b00338bcb..5d83456ee 100644 --- a/tests/Zend/Application/Resource/SessionTest.php +++ b/tests/Zend/Application/Resource/SessionTest.php @@ -17,18 +17,14 @@ * * @version $Id$ */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; -require_once 'Zend/Application/Resource/Session.php'; -require_once 'Zend/Session.php'; require_once 'Zend/Session/SaveHandler/Interface.php'; /** - * @group Zend_Application - * * @license http://framework.zend.com/license/new-bsd New BSD License */ #[AllowDynamicProperties] -class Zend_Application_Resource_SessionTest extends \PHPUnit\Framework\TestCase +#[PHPUnit\Framework\Attributes\Group('Zend_Application')] +class Zend_Application_Resource_SessionTest extends PHPUnit\Framework\TestCase { public $resource; @@ -39,7 +35,7 @@ public function setUp(): void public function testSetSaveHandler() { - $saveHandler = $this->createMock(\Zend_Session_SaveHandler_Interface::class); + $saveHandler = $this->createMock(Zend_Session_SaveHandler_Interface::class); $this->resource->setSaveHandler($saveHandler); $this->assertSame($saveHandler, $this->resource->getSaveHandler()); @@ -47,7 +43,7 @@ public function testSetSaveHandler() public function testSetSaveHandlerString() { - $saveHandler = $this->createMock(\Zend_Session_SaveHandler_Interface::class); + $saveHandler = $this->createMock(Zend_Session_SaveHandler_Interface::class); $saveHandlerClassName = $saveHandler::class; $this->resource->setSaveHandler($saveHandlerClassName); @@ -57,7 +53,7 @@ public function testSetSaveHandlerString() public function testSetSaveHandlerArray() { - $saveHandler = $this->createMock(\Zend_Session_SaveHandler_Interface::class); + $saveHandler = $this->createMock(Zend_Session_SaveHandler_Interface::class); $saveHandlerClassName = $saveHandler::class; $this->resource->setSaveHandler(['class' => $saveHandlerClassName]); @@ -65,9 +61,7 @@ public function testSetSaveHandlerArray() $this->assertTrue($this->resource->getSaveHandler() instanceof $saveHandlerClassName); } - /** - * @runInSeparateProcess - */ + #[PHPUnit\Framework\Attributes\RunInSeparateProcess] public function testSetOptions() { Zend_Session::setOptions([ @@ -90,7 +84,7 @@ public function testInitSetsSaveHandler() { Zend_Session::$_unitTestEnabled = true; - $saveHandler = $this->createMock(\Zend_Session_SaveHandler_Interface::class); + $saveHandler = $this->createMock(Zend_Session_SaveHandler_Interface::class); $this->resource->setSaveHandler($saveHandler); diff --git a/tests/Zend/Application/Resource/TestAsset/ViewRenderer.php b/tests/Zend/Application/Resource/TestAsset/ViewRenderer.php index cd9434747..567cd9856 100644 --- a/tests/Zend/Application/Resource/TestAsset/ViewRenderer.php +++ b/tests/Zend/Application/Resource/TestAsset/ViewRenderer.php @@ -1,4 +1,5 @@ run($suite); - } - - public function setUp(): void - { - // Store original autoloaders - $this->loaders = spl_autoload_functions(); - if (!is_array($this->loaders)) { - // spl_autoload_functions does not return empty array when no - // autoloaders registered... - $this->loaders = []; - } - - Zend_Loader_Autoloader::resetInstance(); - $this->autoloader = Zend_Loader_Autoloader::getInstance(); - - $this->application = new Zend_Application('testing'); - - require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; - $this->bootstrap = new ZfAppBootstrap($this->application); - - Zend_Controller_Action_HelperBroker::resetHelpers(); - } - - public function tearDown(): void - { - // Restore original autoloaders - $loaders = spl_autoload_functions(); - foreach ($loaders as $loader) { - spl_autoload_unregister($loader); - } - - foreach ($this->loaders as $loader) { - spl_autoload_register($loader); - } - - // Reset autoloader instance so it doesn't affect other tests - Zend_Loader_Autoloader::resetInstance(); - } - - public function testInitializationInitializesUserAgentObject() - { - $resource = new Zend_Application_Resource_Useragent([]); - $resource->setBootstrap($this->bootstrap); - $resource->init(); - $this->assertTrue($resource->getUserAgent() instanceof Zend_Http_UserAgent); - } - - public function testOptionsPassedToResourceAreUsedToSetUserAgentState() - { - $options = [ - 'storage' => ['adapter' => 'NonPersistent'], - ]; - $resource = new Zend_Application_Resource_Useragent($options); - $resource->setBootstrap($this->bootstrap); - $resource->init(); - $ua = $resource->getUserAgent(); - $storage = $ua->getStorage(); - $this->assertTrue($storage instanceof Zend_Http_UserAgent_Storage_NonPersistent); - } - - public function testInjectsUserAgentIntoViewHelperWhenViewResourcePresent() - { - $this->bootstrap->registerPluginResource('view', []); - $resource = new Zend_Application_Resource_Useragent([]); - $resource->setBootstrap($this->bootstrap); - $resource->init(); - - $view = $this->bootstrap->getResource('view'); - $helper = $view->getHelper('userAgent'); - - $expected = $resource->getUserAgent(); - $this->assertSame($expected, $helper->getUserAgent()); - } -} diff --git a/tests/Zend/Application/Resource/ViewTest.php b/tests/Zend/Application/Resource/ViewTest.php index 82b824af1..52ea96ff9 100644 --- a/tests/Zend/Application/Resource/ViewTest.php +++ b/tests/Zend/Application/Resource/ViewTest.php @@ -1,4 +1,5 @@ run($suite); - } - public function setUp(): void { // Store original autoloaders @@ -96,7 +90,6 @@ public function testOptionsPassedToResourceAreUsedToSetViewState() $options = [ 'scriptPath' => __DIR__, ]; - require_once 'Zend/Application/Resource/View.php'; $resource = new Zend_Application_Resource_View($options); $resource->init(); $view = $resource->getView(); @@ -106,16 +99,14 @@ public function testOptionsPassedToResourceAreUsedToSetViewState() public function testDoctypeIsSet() { - $options = ['doctype' => 'XHTML1_FRAMESET']; + $options = ['doctype' => 'HTML5']; $resource = new Zend_Application_Resource_View($options); $resource->init(); $view = $resource->getView(); - $this->assertEquals('XHTML1_FRAMESET', $view->doctype()->getDoctype()); + $this->assertEquals('HTML5', $view->doctype()->getDoctype()); } - /** - * @group ZF-10343 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-10343')] public function testContentTypeIsSet() { $contentType = 'text/html; charset=UTF-8'; @@ -136,12 +127,10 @@ public function testContentTypeIsSet() $this->assertEquals($contentType, $actual); Zend_View_Helper_Placeholder_Registry::getRegistry() - ->deleteContainer(\Zend_View_Helper_HeadMeta::class); + ->deleteContainer(Zend_View_Helper_HeadMeta::class); } - /** - * @group ZF-10343 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-10343')] public function testSetMetaCharsetForHtml5() { $charset = 'UTF-8'; @@ -167,45 +156,11 @@ public function testSetMetaCharsetForHtml5() $this->assertEquals($charset, $actual); $registry = Zend_View_Helper_Placeholder_Registry::getRegistry(); - $registry->deleteContainer(\Zend_View_Helper_HeadMeta::class); - $registry->deleteContainer(\Zend_View_Helper_Doctype::class); - } - - /** - * @group ZF-10343 - */ - public function testSetMetaCharsetShouldOnlyAvailableForHtml5() - { - $charset = 'UTF-8'; - $options = [ - 'doctype' => 'XHTML1_STRICT', - 'charset' => $charset, - ]; - $resource = new Zend_Application_Resource_View($options); - $view = $resource->init(); - $headMetaHelper = $view->headMeta(); - - $actual = null; - $container = $headMetaHelper->getContainer(); - foreach ($container as $item) { - if ('charset' == $item->type) { - $actual = $item->charset; - - break; - } - } - - $this->assertFalse($view->doctype()->isHtml5()); - $this->assertNull($actual); - - $registry = Zend_View_Helper_Placeholder_Registry::getRegistry(); - $registry->deleteContainer(\Zend_View_Helper_HeadMeta::class); - $registry->deleteContainer(\Zend_View_Helper_Doctype::class); + $registry->deleteContainer(Zend_View_Helper_HeadMeta::class); + $registry->deleteContainer(Zend_View_Helper_Doctype::class); } - /** - * @group ZF-10042 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-10042')] public function testAssignmentsAreSet() { $options = [ @@ -221,9 +176,7 @@ public function testAssignmentsAreSet() $this->assertEquals('barbazoo', $view->bar); } - /** - * @group ZF-11579 - */ + #[PHPUnit\Framework\Attributes\Group('ZF-11579')] public function testViewResourceDoesNotReinjectViewRenderer() { require_once __DIR__ . '/TestAsset/ViewRenderer.php'; diff --git a/tests/Zend/Application/Resource/_files/ZfAppBootstrapCustomView.php b/tests/Zend/Application/Resource/_files/ZfAppBootstrapCustomView.php index d41f5289c..44dcc3a32 100644 --- a/tests/Zend/Application/Resource/_files/ZfAppBootstrapCustomView.php +++ b/tests/Zend/Application/Resource/_files/ZfAppBootstrapCustomView.php @@ -1,4 +1,5 @@ run($suite); - } - - /** - * Sets up the fixture, for example, open a network connection. - * This method is called before a test is executed. - */ - public function setUp(): void - { - if (isset($this->word)) { - unset($this->word); - } - - $this->element = new Zend_Form_Element_Captcha( - 'captchaD', - [ - 'captcha' => [ - 'Dumb', - 'sessionClass' => 'Zend_Captcha_DumbTest_SessionContainer', - ], - ] - ); - $this->captcha = $this->element->getCaptcha(); - } - - /** - * Tears down the fixture, for example, close a network connection. - * This method is called after a test is executed. - */ - public function tearDown(): void - { - } - - public function testRendersWordInReverse() - { - $id = $this->captcha->generate('test'); - $word = $this->captcha->getWord(); - $html = $this->captcha->render(new Zend_View()); - $this->assertStringContainsString(strrev($word), $html); - $this->assertStringNotContainsString($word, $html); - } - - /** - * @group ZF-11522 - */ - public function testDefaultLabelIsUsedWhenNoAlternateLabelSet() - { - $this->assertEquals('Please type this word backwards', $this->captcha->getLabel()); - } - - /** - * @group ZF-11522 - */ - public function testChangeLabelViaSetterMethod() - { - $this->captcha->setLabel('Testing'); - $this->assertEquals('Testing', $this->captcha->getLabel()); - } - - /** - * @group ZF-11522 - */ - public function testRendersLabelUsingProvidedValue() - { - $this->captcha->setLabel('Testing 123'); - - $id = $this->captcha->generate('test'); - $html = $this->captcha->render(new Zend_View()); - $this->assertStringContainsString('Testing 123', $html); - } -} - -#[AllowDynamicProperties] -class Zend_Captcha_DumbTest_SessionContainer -{ - protected static $_word; - - public function __get($name) - { - if ('word' == $name) { - return self::$_word; - } - - return null; - } - - public function __set($name, $value) - { - if ('word' == $name) { - self::$_word = $value; - } else { - $this->$name = $value; - } - } - - public function __isset($name) - { - if (('word' == $name) && (null !== self::$_word)) { - return true; - } - - return false; - } - - public function __call($method, $args) - { - $this->$method = match ($method) { - 'setExpirationHops', 'setExpirationSeconds' => array_shift($args), - }; - } -} diff --git a/tests/Zend/Captcha/FigletTest.php b/tests/Zend/Captcha/FigletTest.php deleted file mode 100644 index 993d1f779..000000000 --- a/tests/Zend/Captcha/FigletTest.php +++ /dev/null @@ -1,339 +0,0 @@ -run($suite); - } - - /** - * Sets up the fixture, for example, open a network connection. - * This method is called before a test is executed. - */ - public function setUp(): void - { - if (isset($this->word)) { - unset($this->word); - } - - $this->element = new Zend_Form_Element_Captcha( - 'captchaF', - [ - 'captcha' => [ - 'Figlet', - 'sessionClass' => 'Zend_Captcha_FigletTest_SessionContainer', - ], - ] - ); - $this->captcha = $this->element->getCaptcha(); - } - - /** - * Tears down the fixture, for example, close a network connection. - * This method is called after a test is executed. - */ - public function tearDown(): void - { - } - - public function testCaptchaAdapterCreated() - { - $this->assertTrue($this->element->getCaptcha() instanceof Zend_Captcha_Adapter); - } - - public function getView() - { - require_once 'Zend/View.php'; - $view = new Zend_View(); - $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper'); - - return $view; - } - - public function testCaptchaIsRendered() - { - $html = $this->element->render($this->getView()); - $this->assertStringContainsString($this->element->getName(), $html); - } - - public function testCaptchaHasIdAndInput() - { - $html = $this->element->render($this->getView()); - $expect = sprintf('type="hidden" name="%s\[id\]" value="%s"', $this->element->getName(), $this->captcha->getId()); - $this->assertMatchesRegularExpression("/]*?$expect/", $html, $html); - $expect = sprintf('type="text" name="%s\[input\]"', $this->element->getName()); - $this->assertMatchesRegularExpression("/]*?$expect/", $html, $html); - } - - // @group ZF-8268 - public function testLabelIdIsCorrect() - { - require_once 'Zend/Form.php'; - $form = new Zend_Form(); - $form->setElementsBelongTo('comment'); - $this->element->setLabel('My Captcha'); - $form->addElement($this->element); - $html = $form->render($this->getView()); - $expect = sprintf('for="comment-%s-input"', $this->element->getName()); - $this->assertMatchesRegularExpression("/