Upload
BIN
website-neu/api/tinify-php-master.zip
Normal file
1
website-neu/api/tinify-php-master/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
vendor
|
30
website-neu/api/tinify-php-master/.travis.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
language: php
|
||||
php:
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- nightly
|
||||
env:
|
||||
global:
|
||||
secure: BFdcLqU/07l3/NGaSZA5+VSB5FSVSwTL9wAyrJSD1N7jN2HzFTE4xxxmcVrAqq6t+jhZqajXcSf8/DTUKyLcmWXGw3JkseHx3ofHw5p2E4Mp+dUvNMh+3KgAABCPm5zEBUgnhNGwFqL+WA/cgXIJY1/sv87u/mg63ojvf3orKJ3KMxFFsVbGo553XYVsiSUXfzvV3foqPdcV9D0SZ0v7IiLcsuwtDRtfJ/udgSZ2C2LFiOek1dLwbjM3inMBPkfLcpuvC2l8Z1CyW5ptxYRrHHJqCMbdRmmwGH04hxRju54EJKX5PGTyDhfG9Kyiu8/hQCtDL4jNQlVNAKbvHrRTnLogoMKhHMRaAIDMNI+lcQB9OHHuureYAqL7gJvRmE2sfN/OAbzizYJ2z+yXvjaKJsd2htrHff8hgvl0M3guhP+mA5C9ubibzGiCD66kdeqS5tJi3EH7wk9GO75lFm3tlZEWZ4FJCwgyFQRZGMGSRJC5cWvW4QlGLHeVnWwnf9CM9/B2oD21LraccgCZhpIbib5/XJ2vTQO0V2ke3kXT1D9E3P8E2eClxnge1aShUSy+d5kMTNeLxkfalgGEviWqA236XLzS8+MjWzNWy3+roBb63Vh0OPp4GyTO810U16Y5lwCMegVrxusnz9bCo1HbK1w2k8D7Ueb/O7LEFYaZSD4=
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
include:
|
||||
- dist: precise
|
||||
php: 5.3
|
||||
- dist: trusty
|
||||
php: hhvm
|
||||
- dist: trusty
|
||||
php: 5.6
|
||||
env: INTEGRATION_TESTS=true
|
||||
script: "if [ \"$TRAVIS_PULL_REQUEST\" == \"false\" ]; then vendor/bin/phpunit --no-configuration test/integration.php; fi"
|
||||
before_script: composer install
|
||||
script: vendor/bin/phpunit
|
||||
notifications:
|
||||
email: false
|
||||
slack:
|
||||
secure: W1cEp+ctAD+in3hA/gansbUYrFZsR3EMd7s/XiK2mfAxRRXPCPgCvv0PWpYelJ5F2AnHXkmBP3USKFDhKN+JLmOOxrZpjzh4ve9QSNs4IPgcrU4meQYSgJ3uovS7h4fqAmqhQKL+FpAnrXAmXWGXVPCPtneySsMTyU6kNdmVfulxXRMJ+kLHtFQlT+U7cPYG0f8FkKR2u5CbRsdjUvoZHwbK7jmWpUcCi2O0A1vvMMEMEOG+iuayWW/RbfSfKIgM/SZG0pGYpoAB7I8XfYns7IyLhkJAw18jIWnowF4DuBusNRdr3zIfwC7bSlLKMFYJYpEsiLFCaeGZgp1NbYJ77DvqpwNp9xmoPz9rFGNe7Re+i13pjNWhEnwc5N3St7x8DYNhUC3L0upQ2FWZSomMM7ghlc6GIVtlXYrRJ5AnxIjSWyLRcTRU5Pf/PPRckOTiuLnVgUZNMVIlAHlRV7c/pUVDjbPvjcOajdXnpcd3+5cuKyzCYpXugIfJ9Hzsozq0yCHDKjo8ssAU+5H3mEfB7M25Rtd2awObb3zqOyUPm+J3M/dzql95cF+zj2SWQsBF/ViwkHo+9SoAr/FYqCZveiS0w9vzoKzbGXVDYCfFD+GlEMJ2b8zw4d2sqmIbw24jGq1ZPgczrpD5fcbI2TaheKBkgWvsBJFFO5KbGWqzHIM=
|
12
website-neu/api/tinify-php-master/CHANGES.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
## 1.5.2
|
||||
* Fail early if version of curl/openssl is too old.
|
||||
|
||||
## 1.5.1
|
||||
* Expose status of exceptions.
|
||||
|
||||
## 1.5.0
|
||||
* Retry failed requests by default.
|
||||
* Throw clearer errors when curl is installed but disabled.
|
||||
|
||||
## 1.4.0
|
||||
* Support for HTTP proxies.
|
21
website-neu/api/tinify-php-master/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2013-2018 Tinify
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
58
website-neu/api/tinify-php-master/README.md
Normal file
|
@ -0,0 +1,58 @@
|
|||
[<img src="https://travis-ci.org/tinify/tinify-php.svg?branch=master" alt="Build Status">](https://travis-ci.org/tinify/tinify-php)
|
||||
|
||||
# Tinify API client for PHP
|
||||
|
||||
PHP client for the Tinify API, used for [TinyPNG](https://tinypng.com) and [TinyJPG](https://tinyjpg.com). Tinify compresses your images intelligently. Read more at [http://tinify.com](http://tinify.com).
|
||||
|
||||
## Documentation
|
||||
|
||||
[Go to the documentation for the PHP client](https://tinypng.com/developers/reference/php).
|
||||
|
||||
## Installation
|
||||
|
||||
Install the API client with Composer. Add this to your `composer.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"tinify/tinify": "*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then install with:
|
||||
|
||||
```
|
||||
composer install
|
||||
```
|
||||
|
||||
Use autoloading to make the client available in PHP:
|
||||
|
||||
```php
|
||||
require_once("vendor/autoload.php");
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```php
|
||||
Tinify\setKey("YOUR_API_KEY");
|
||||
Tinify\fromFile("unoptimized.png")->toFile("optimized.png");
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
```
|
||||
composer install
|
||||
vendor/bin/phpunit
|
||||
```
|
||||
|
||||
### Integration tests
|
||||
|
||||
```
|
||||
composer install
|
||||
TINIFY_KEY=$YOUR_API_KEY vendor/bin/phpunit --no-configuration test/integration.php
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This software is licensed under the MIT License. [View the license](LICENSE).
|
41
website-neu/api/tinify-php-master/composer.json
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "tinify/tinify",
|
||||
"description": "PHP client for the Tinify API. Tinify compresses your images intelligently. Read more at https://tinify.com.",
|
||||
"keywords": [
|
||||
"tinify",
|
||||
"tinypng",
|
||||
"tinyjpg",
|
||||
"compress",
|
||||
"images",
|
||||
"api"
|
||||
],
|
||||
|
||||
"homepage": "https://tinify.com/developers",
|
||||
"license": "MIT",
|
||||
|
||||
"support": {
|
||||
"email": "support@tinify.com"
|
||||
},
|
||||
|
||||
"authors": [{
|
||||
"name": "Rolf Timmermans",
|
||||
"email": "rolftimmermans@voormedia.com"
|
||||
}],
|
||||
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"lib-curl": ">=7.20.0"
|
||||
},
|
||||
|
||||
"require-dev": {
|
||||
"symfony/yaml": "~2.0",
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
|
||||
"autoload": {
|
||||
"files": ["lib/Tinify.php", "lib/Tinify/Exception.php"],
|
||||
"psr-4": {"Tinify\\": "lib/Tinify/"}
|
||||
}
|
||||
}
|
977
website-neu/api/tinify-php-master/composer.lock
generated
Normal file
|
@ -0,0 +1,977 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "24129bff61e8cfa8b2a82efee5c7069a",
|
||||
"content-hash": "6251dc24eeaff94cb037569e414a6195",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
"version": "1.0.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/instantiator.git",
|
||||
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
|
||||
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3,<8.0-DEV"
|
||||
},
|
||||
"require-dev": {
|
||||
"athletic/athletic": "~0.1.8",
|
||||
"ext-pdo": "*",
|
||||
"ext-phar": "*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"squizlabs/php_codesniffer": "~2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com",
|
||||
"homepage": "http://ocramius.github.com/"
|
||||
}
|
||||
],
|
||||
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
||||
"homepage": "https://github.com/doctrine/instantiator",
|
||||
"keywords": [
|
||||
"constructor",
|
||||
"instantiate"
|
||||
],
|
||||
"time": "2015-06-14 21:17:01"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
"version": "2.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
||||
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
|
||||
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"dflydev/markdown": "~1.0",
|
||||
"erusev/parsedown": "~1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"phpDocumentor": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mike van Riel",
|
||||
"email": "mike.vanriel@naenius.com"
|
||||
}
|
||||
],
|
||||
"time": "2015-02-03 12:10:50"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
"version": "v1.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpspec/prophecy.git",
|
||||
"reference": "3c91bdf81797d725b14cb62906f9a4ce44235972"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972",
|
||||
"reference": "3c91bdf81797d725b14cb62906f9a4ce44235972",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/instantiator": "^1.0.2",
|
||||
"php": "^5.3|^7.0",
|
||||
"phpdocumentor/reflection-docblock": "~2.0",
|
||||
"sebastian/comparator": "~1.1",
|
||||
"sebastian/recursion-context": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/phpspec": "~2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.5.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Prophecy\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Konstantin Kudryashov",
|
||||
"email": "ever.zet@gmail.com",
|
||||
"homepage": "http://everzet.com"
|
||||
},
|
||||
{
|
||||
"name": "Marcello Duarte",
|
||||
"email": "marcello.duarte@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Highly opinionated mocking framework for PHP 5.3+",
|
||||
"homepage": "https://github.com/phpspec/prophecy",
|
||||
"keywords": [
|
||||
"Double",
|
||||
"Dummy",
|
||||
"fake",
|
||||
"mock",
|
||||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"time": "2016-02-15 07:46:21"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "2.2.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
|
||||
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"phpunit/php-file-iterator": "~1.3",
|
||||
"phpunit/php-text-template": "~1.2",
|
||||
"phpunit/php-token-stream": "~1.3",
|
||||
"sebastian/environment": "^1.3.2",
|
||||
"sebastian/version": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-xdebug": ">=2.1.4",
|
||||
"phpunit/phpunit": "~4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-dom": "*",
|
||||
"ext-xdebug": ">=2.2.1",
|
||||
"ext-xmlwriter": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
|
||||
"keywords": [
|
||||
"coverage",
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-10-06 15:47:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
"version": "1.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
||||
"reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
|
||||
"reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
|
||||
"keywords": [
|
||||
"filesystem",
|
||||
"iterator"
|
||||
],
|
||||
"time": "2015-06-21 13:08:43"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-text-template",
|
||||
"version": "1.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-text-template.git",
|
||||
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
|
||||
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Simple template engine.",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
|
||||
"keywords": [
|
||||
"template"
|
||||
],
|
||||
"time": "2015-06-21 13:50:34"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-timer",
|
||||
"version": "1.0.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
||||
"reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
|
||||
"reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Utility class for timing",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-timer/",
|
||||
"keywords": [
|
||||
"timer"
|
||||
],
|
||||
"time": "2015-06-21 08:01:12"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-token-stream",
|
||||
"version": "1.4.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
||||
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
|
||||
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-tokenizer": "*",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Wrapper around PHP's tokenizer extension.",
|
||||
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
|
||||
"keywords": [
|
||||
"tokenizer"
|
||||
],
|
||||
"time": "2015-09-15 10:49:45"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "4.8.24",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "a1066c562c52900a142a0e2bbf0582994671385e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1066c562c52900a142a0e2bbf0582994671385e",
|
||||
"reference": "a1066c562c52900a142a0e2bbf0582994671385e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"ext-pcre": "*",
|
||||
"ext-reflection": "*",
|
||||
"ext-spl": "*",
|
||||
"php": ">=5.3.3",
|
||||
"phpspec/prophecy": "^1.3.1",
|
||||
"phpunit/php-code-coverage": "~2.1",
|
||||
"phpunit/php-file-iterator": "~1.4",
|
||||
"phpunit/php-text-template": "~1.2",
|
||||
"phpunit/php-timer": ">=1.0.6",
|
||||
"phpunit/phpunit-mock-objects": "~2.3",
|
||||
"sebastian/comparator": "~1.1",
|
||||
"sebastian/diff": "~1.2",
|
||||
"sebastian/environment": "~1.3",
|
||||
"sebastian/exporter": "~1.2",
|
||||
"sebastian/global-state": "~1.0",
|
||||
"sebastian/version": "~1.0",
|
||||
"symfony/yaml": "~2.1|~3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"phpunit/php-invoker": "~1.1"
|
||||
},
|
||||
"bin": [
|
||||
"phpunit"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.8.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "The PHP Unit Testing framework.",
|
||||
"homepage": "https://phpunit.de/",
|
||||
"keywords": [
|
||||
"phpunit",
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2016-03-14 06:16:08"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
"version": "2.3.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
|
||||
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/instantiator": "^1.0.2",
|
||||
"php": ">=5.3.3",
|
||||
"phpunit/php-text-template": "~1.2",
|
||||
"sebastian/exporter": "~1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-soap": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Mock Object library for PHPUnit",
|
||||
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
|
||||
"keywords": [
|
||||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-10-02 06:51:40"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
"version": "1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
|
||||
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"sebastian/diff": "~1.2",
|
||||
"sebastian/exporter": "~1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeff Welch",
|
||||
"email": "whatthejeff@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Volker Dusch",
|
||||
"email": "github@wallbash.com"
|
||||
},
|
||||
{
|
||||
"name": "Bernhard Schussek",
|
||||
"email": "bschussek@2bepublished.at"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Provides the functionality to compare PHP values for equality",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/comparator",
|
||||
"keywords": [
|
||||
"comparator",
|
||||
"compare",
|
||||
"equality"
|
||||
],
|
||||
"time": "2015-07-26 15:48:44"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "1.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
|
||||
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kore Nordmann",
|
||||
"email": "mail@kore-nordmann.de"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Diff implementation",
|
||||
"homepage": "https://github.com/sebastianbergmann/diff",
|
||||
"keywords": [
|
||||
"diff"
|
||||
],
|
||||
"time": "2015-12-08 07:14:41"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
"version": "1.3.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/environment.git",
|
||||
"reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf",
|
||||
"reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Provides functionality to handle HHVM/PHP environments",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/environment",
|
||||
"keywords": [
|
||||
"Xdebug",
|
||||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"time": "2016-02-26 18:40:46"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
"version": "1.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/exporter.git",
|
||||
"reference": "7ae5513327cb536431847bcc0c10edba2701064e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e",
|
||||
"reference": "7ae5513327cb536431847bcc0c10edba2701064e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"sebastian/recursion-context": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeff Welch",
|
||||
"email": "whatthejeff@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Volker Dusch",
|
||||
"email": "github@wallbash.com"
|
||||
},
|
||||
{
|
||||
"name": "Bernhard Schussek",
|
||||
"email": "bschussek@2bepublished.at"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
},
|
||||
{
|
||||
"name": "Adam Harvey",
|
||||
"email": "aharvey@php.net"
|
||||
}
|
||||
],
|
||||
"description": "Provides the functionality to export PHP variables for visualization",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/exporter",
|
||||
"keywords": [
|
||||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"time": "2015-06-21 07:55:53"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
"version": "1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/global-state.git",
|
||||
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
|
||||
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.2"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-uopz": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"description": "Snapshotting of global state",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/global-state",
|
||||
"keywords": [
|
||||
"global state"
|
||||
],
|
||||
"time": "2015-10-12 03:26:01"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/recursion-context.git",
|
||||
"reference": "913401df809e99e4f47b27cdd781f4a258d58791"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
|
||||
"reference": "913401df809e99e4f47b27cdd781f4a258d58791",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeff Welch",
|
||||
"email": "whatthejeff@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
},
|
||||
{
|
||||
"name": "Adam Harvey",
|
||||
"email": "aharvey@php.net"
|
||||
}
|
||||
],
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"time": "2015-11-11 19:50:13"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/version",
|
||||
"version": "1.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/version.git",
|
||||
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
|
||||
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"time": "2015-06-21 13:59:46"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v2.8.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "584e52cb8f788a887553ba82db6caacb1d6260bb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/584e52cb8f788a887553ba82db6caacb1d6260bb",
|
||||
"reference": "584e52cb8f788a887553ba82db6caacb1d6260bb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.9"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.8-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Yaml\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-03-04 07:54:35"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.3.0",
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"lib-curl": ">=7.20.0"
|
||||
},
|
||||
"platform-dev": []
|
||||
}
|
96
website-neu/api/tinify-php-master/lib/Tinify.php
Normal file
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
namespace Tinify;
|
||||
|
||||
const VERSION = "1.5.2";
|
||||
|
||||
class Tinify {
|
||||
private static $key = NULL;
|
||||
private static $appIdentifier = NULL;
|
||||
private static $proxy = NULL;
|
||||
|
||||
private static $compressionCount = NULL;
|
||||
private static $client = NULL;
|
||||
|
||||
public static function setKey($key) {
|
||||
self::$key = $key;
|
||||
self::$client = NULL;
|
||||
}
|
||||
|
||||
public static function setAppIdentifier($appIdentifier) {
|
||||
self::$appIdentifier = $appIdentifier;
|
||||
self::$client = NULL;
|
||||
}
|
||||
|
||||
public static function setProxy($proxy) {
|
||||
self::$proxy = $proxy;
|
||||
self::$client = NULL;
|
||||
}
|
||||
|
||||
public static function getCompressionCount() {
|
||||
return self::$compressionCount;
|
||||
}
|
||||
|
||||
public static function setCompressionCount($compressionCount) {
|
||||
self::$compressionCount = $compressionCount;
|
||||
}
|
||||
|
||||
public static function getClient() {
|
||||
if (!self::$key) {
|
||||
throw new AccountException("Provide an API key with Tinify\setKey(...)");
|
||||
}
|
||||
|
||||
if (!self::$client) {
|
||||
self::$client = new Client(self::$key, self::$appIdentifier, self::$proxy);
|
||||
}
|
||||
|
||||
return self::$client;
|
||||
}
|
||||
|
||||
public static function setClient($client) {
|
||||
self::$client = $client;
|
||||
}
|
||||
}
|
||||
|
||||
function setKey($key) {
|
||||
return Tinify::setKey($key);
|
||||
}
|
||||
|
||||
function setAppIdentifier($appIdentifier) {
|
||||
return Tinify::setAppIdentifier($appIdentifier);
|
||||
}
|
||||
|
||||
function setProxy($proxy) {
|
||||
return Tinify::setProxy($proxy);
|
||||
}
|
||||
|
||||
function getCompressionCount() {
|
||||
return Tinify::getCompressionCount();
|
||||
}
|
||||
|
||||
function compressionCount() {
|
||||
return Tinify::getCompressionCount();
|
||||
}
|
||||
|
||||
function fromFile($path) {
|
||||
return Source::fromFile($path);
|
||||
}
|
||||
|
||||
function fromBuffer($string) {
|
||||
return Source::fromBuffer($string);
|
||||
}
|
||||
|
||||
function fromUrl($string) {
|
||||
return Source::fromUrl($string);
|
||||
}
|
||||
|
||||
function validate() {
|
||||
try {
|
||||
Tinify::getClient()->request("post", "/shrink");
|
||||
} catch (AccountException $err) {
|
||||
if ($err->status == 429) return true;
|
||||
throw $err;
|
||||
} catch (ClientException $err) {
|
||||
return true;
|
||||
}
|
||||
}
|
160
website-neu/api/tinify-php-master/lib/Tinify/Client.php
Normal file
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
|
||||
namespace Tinify;
|
||||
|
||||
class Client {
|
||||
const API_ENDPOINT = "https://api.tinify.com";
|
||||
|
||||
const RETRY_COUNT = 1;
|
||||
const RETRY_DELAY = 500;
|
||||
|
||||
private $options;
|
||||
|
||||
public static function userAgent() {
|
||||
$curl = curl_version();
|
||||
return "Tinify/" . VERSION . " PHP/" . PHP_VERSION . " curl/" . $curl["version"];
|
||||
}
|
||||
|
||||
private static function caBundle() {
|
||||
return __DIR__ . "/../data/cacert.pem";
|
||||
}
|
||||
|
||||
function __construct($key, $app_identifier = NULL, $proxy = NULL) {
|
||||
$curl = curl_version();
|
||||
|
||||
if (!($curl["features"] & CURL_VERSION_SSL)) {
|
||||
throw new ClientException("Your curl version does not support secure connections");
|
||||
}
|
||||
|
||||
if ($curl["version_number"] < 0x071201) {
|
||||
$version = $curl["version"];
|
||||
throw new ClientException("Your curl version ${version} is outdated; please upgrade to 7.18.1 or higher");
|
||||
}
|
||||
|
||||
$this->options = array(
|
||||
CURLOPT_BINARYTRANSFER => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HEADER => true,
|
||||
CURLOPT_USERPWD => "api:" . $key,
|
||||
CURLOPT_CAINFO => self::caBundle(),
|
||||
CURLOPT_SSL_VERIFYPEER => true,
|
||||
CURLOPT_USERAGENT => join(" ", array_filter(array(self::userAgent(), $app_identifier))),
|
||||
);
|
||||
|
||||
if ($proxy) {
|
||||
$parts = parse_url($proxy);
|
||||
if (isset($parts["host"])) {
|
||||
$this->options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP;
|
||||
$this->options[CURLOPT_PROXY] = $parts["host"];
|
||||
} else {
|
||||
throw new ConnectionException("Invalid proxy");
|
||||
}
|
||||
|
||||
if (isset($parts["port"])) {
|
||||
$this->options[CURLOPT_PROXYPORT] = $parts["port"];
|
||||
}
|
||||
|
||||
$creds = "";
|
||||
if (isset($parts["user"])) $creds .= $parts["user"];
|
||||
if (isset($parts["pass"])) $creds .= ":" . $parts["pass"];
|
||||
|
||||
if ($creds) {
|
||||
$this->options[CURLOPT_PROXYAUTH] = CURLAUTH_ANY;
|
||||
$this->options[CURLOPT_PROXYUSERPWD] = $creds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function request($method, $url, $body = NULL) {
|
||||
$header = array();
|
||||
if (is_array($body)) {
|
||||
if (!empty($body)) {
|
||||
$body = json_encode($body);
|
||||
array_push($header, "Content-Type: application/json");
|
||||
} else {
|
||||
$body = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for ($retries = self::RETRY_COUNT; $retries >= 0; $retries--) {
|
||||
if ($retries < self::RETRY_COUNT) {
|
||||
usleep(self::RETRY_DELAY * 1000);
|
||||
}
|
||||
|
||||
$request = curl_init();
|
||||
if ($request === false || $request === null) {
|
||||
throw new ConnectionException(
|
||||
"Error while connecting: curl extension is not functional or disabled."
|
||||
);
|
||||
}
|
||||
|
||||
curl_setopt_array($request, $this->options);
|
||||
|
||||
$url = strtolower(substr($url, 0, 6)) == "https:" ? $url : self::API_ENDPOINT . $url;
|
||||
curl_setopt($request, CURLOPT_URL, $url);
|
||||
curl_setopt($request, CURLOPT_CUSTOMREQUEST, strtoupper($method));
|
||||
|
||||
if (count($header) > 0) {
|
||||
curl_setopt($request, CURLOPT_HTTPHEADER, $header);
|
||||
}
|
||||
|
||||
if ($body) {
|
||||
curl_setopt($request, CURLOPT_POSTFIELDS, $body);
|
||||
}
|
||||
|
||||
$response = curl_exec($request);
|
||||
|
||||
if (is_string($response)) {
|
||||
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
|
||||
$headerSize = curl_getinfo($request, CURLINFO_HEADER_SIZE);
|
||||
curl_close($request);
|
||||
|
||||
$headers = self::parseHeaders(substr($response, 0, $headerSize));
|
||||
$body = substr($response, $headerSize);
|
||||
|
||||
if (isset($headers["compression-count"])) {
|
||||
Tinify::setCompressionCount(intval($headers["compression-count"]));
|
||||
}
|
||||
|
||||
if ($status >= 200 && $status <= 299) {
|
||||
return (object) array("body" => $body, "headers" => $headers);
|
||||
}
|
||||
|
||||
$details = json_decode($body);
|
||||
if (!$details) {
|
||||
$message = sprintf("Error while parsing response: %s (#%d)",
|
||||
PHP_VERSION_ID >= 50500 ? json_last_error_msg() : "Error",
|
||||
json_last_error());
|
||||
$details = (object) array(
|
||||
"message" => $message,
|
||||
"error" => "ParseError"
|
||||
);
|
||||
}
|
||||
|
||||
if ($retries > 0 && $status >= 500) continue;
|
||||
throw Exception::create($details->message, $details->error, $status);
|
||||
} else {
|
||||
$message = sprintf("%s (#%d)", curl_error($request), curl_errno($request));
|
||||
curl_close($request);
|
||||
if ($retries > 0) continue;
|
||||
throw new ConnectionException("Error while connecting: " . $message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static function parseHeaders($headers) {
|
||||
if (!is_array($headers)) {
|
||||
$headers = explode("\r\n", $headers);
|
||||
}
|
||||
|
||||
$res = array();
|
||||
foreach ($headers as $header) {
|
||||
if (empty($header)) continue;
|
||||
$split = explode(":", $header, 2);
|
||||
if (count($split) === 2) {
|
||||
$res[strtolower($split[0])] = trim($split[1]);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
36
website-neu/api/tinify-php-master/lib/Tinify/Exception.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace Tinify;
|
||||
|
||||
class Exception extends \Exception {
|
||||
public $status;
|
||||
|
||||
public static function create($message, $type, $status) {
|
||||
if ($status == 401 || $status == 429) {
|
||||
$klass = "Tinify\AccountException";
|
||||
} else if($status >= 400 && $status <= 499) {
|
||||
$klass = "Tinify\ClientException";
|
||||
} else if($status >= 500 && $status <= 599) {
|
||||
$klass = "Tinify\ServerException";
|
||||
} else {
|
||||
$klass = "Tinify\Exception";
|
||||
}
|
||||
|
||||
if (empty($message)) $message = "No message was provided";
|
||||
return new $klass($message, $type, $status);
|
||||
}
|
||||
|
||||
function __construct($message, $type = NULL, $status = NULL) {
|
||||
$this->status = $status;
|
||||
if ($status) {
|
||||
parent::__construct($message . " (HTTP " . $status . "/" . $type . ")");
|
||||
} else {
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AccountException extends Exception {}
|
||||
class ClientException extends Exception {}
|
||||
class ServerException extends Exception {}
|
||||
class ConnectionException extends Exception {}
|
36
website-neu/api/tinify-php-master/lib/Tinify/Result.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace Tinify;
|
||||
|
||||
class Result extends ResultMeta {
|
||||
protected $data;
|
||||
|
||||
public function __construct($meta, $data) {
|
||||
$this->meta = $meta;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function data() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function toBuffer() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function toFile($path) {
|
||||
return file_put_contents($path, $this->toBuffer());
|
||||
}
|
||||
|
||||
public function size() {
|
||||
return intval($this->meta["content-length"]);
|
||||
}
|
||||
|
||||
public function mediaType() {
|
||||
return $this->meta["content-type"];
|
||||
}
|
||||
|
||||
public function contentType() {
|
||||
return $this->mediaType();
|
||||
}
|
||||
}
|
23
website-neu/api/tinify-php-master/lib/Tinify/ResultMeta.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Tinify;
|
||||
|
||||
class ResultMeta {
|
||||
protected $meta;
|
||||
|
||||
public function __construct($meta) {
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function width() {
|
||||
return intval($this->meta["image-width"]);
|
||||
}
|
||||
|
||||
public function height() {
|
||||
return intval($this->meta["image-height"]);
|
||||
}
|
||||
|
||||
public function location() {
|
||||
return isset($this->meta["location"]) ? $this->meta["location"] : null;
|
||||
}
|
||||
}
|
69
website-neu/api/tinify-php-master/lib/Tinify/Source.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace Tinify;
|
||||
|
||||
class Source {
|
||||
private $url, $commands;
|
||||
|
||||
public static function fromFile($path) {
|
||||
return self::fromBuffer(file_get_contents($path));
|
||||
}
|
||||
|
||||
public static function fromBuffer($string) {
|
||||
$response = Tinify::getClient()->request("post", "/shrink", $string);
|
||||
return new self($response->headers["location"]);
|
||||
}
|
||||
|
||||
public static function fromUrl($url) {
|
||||
$body = array("source" => array("url" => $url));
|
||||
$response = Tinify::getClient()->request("post", "/shrink", $body);
|
||||
return new self($response->headers["location"]);
|
||||
}
|
||||
|
||||
public function __construct($url, $commands = array()) {
|
||||
$this->url = $url;
|
||||
$this->commands = $commands;
|
||||
}
|
||||
|
||||
public function preserve() {
|
||||
$options = $this->flatten(func_get_args());
|
||||
$commands = array_merge($this->commands, array("preserve" => $options));
|
||||
return new self($this->url, $commands);
|
||||
}
|
||||
|
||||
public function resize($options) {
|
||||
$commands = array_merge($this->commands, array("resize" => $options));
|
||||
return new self($this->url, $commands);
|
||||
}
|
||||
|
||||
public function store($options) {
|
||||
$response = Tinify::getClient()->request("post", $this->url,
|
||||
array_merge($this->commands, array("store" => $options)));
|
||||
return new Result($response->headers, $response->body);
|
||||
}
|
||||
|
||||
public function result() {
|
||||
$response = Tinify::getClient()->request("get", $this->url, $this->commands);
|
||||
return new Result($response->headers, $response->body);
|
||||
}
|
||||
|
||||
public function toFile($path) {
|
||||
return $this->result()->toFile($path);
|
||||
}
|
||||
|
||||
public function toBuffer() {
|
||||
return $this->result()->toBuffer();
|
||||
}
|
||||
|
||||
private static function flatten($options) {
|
||||
$flattened = array();
|
||||
foreach ($options as $option) {
|
||||
if (is_array($option)) {
|
||||
$flattened = array_merge($flattened, $option);
|
||||
} else {
|
||||
array_push($flattened, $option);
|
||||
}
|
||||
}
|
||||
return $flattened;
|
||||
}
|
||||
}
|
3550
website-neu/api/tinify-php-master/lib/data/cacert.pem
Normal file
12
website-neu/api/tinify-php-master/phpunit.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<phpunit bootstrap="test/helper.php" colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="Tinify PHP Test Suite">
|
||||
<directory suffix="Test.php">test</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>lib</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
282
website-neu/api/tinify-php-master/test/TinifyClientTest.php
Normal file
|
@ -0,0 +1,282 @@
|
|||
<?php
|
||||
|
||||
use Tinify\CurlMock;
|
||||
|
||||
class TinifyClientTest extends TestCase {
|
||||
public function testRequestWhenValidShouldIssueRequest() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
|
||||
$this->assertSame("https://api.tinify.com/", CurlMock::last(CURLOPT_URL));
|
||||
$this->assertSame("api:key", CurlMock::last(CURLOPT_USERPWD));
|
||||
}
|
||||
|
||||
public function testRequestWhenValidShouldIssueRequestWithoutBodyWhenOptionsAreEmpty() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/", array());
|
||||
|
||||
$this->assertFalse(CurlMock::last_has(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testRequestWhenValidShouldIssueRequestWithoutContentTypeWhenOptionsAreEmpty() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/", array());
|
||||
|
||||
$this->assertFalse(CurlMock::last_has(CURLOPT_HTTPHEADER));
|
||||
}
|
||||
|
||||
public function testRequestWhenValidShouldIssueRequestWithJSONBody() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/", array("hello" => "world"));
|
||||
|
||||
$this->assertSame(array("Content-Type: application/json"), CurlMock::last(CURLOPT_HTTPHEADER));
|
||||
$this->assertSame('{"hello":"world"}', CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testRequestWhenValidShouldIssueRequestWithUserAgent() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
|
||||
$this->assertSame(Tinify\Client::userAgent(), CurlMock::last(CURLOPT_USERAGENT));
|
||||
}
|
||||
|
||||
public function testRequestWhenValidShouldUpdateCompressionCount() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 200, "headers" => array("Compression-Count" => "12")
|
||||
));
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
|
||||
$this->assertSame(12, Tinify\getCompressionCount());
|
||||
}
|
||||
|
||||
public function testRequestWhenValidWithAppIdShouldIssueRequestWithUserAgent() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
$client = new Tinify\Client("key", "TestApp/0.1");
|
||||
$client->request("get", "/");
|
||||
|
||||
$this->assertSame(Tinify\Client::userAgent() . " TestApp/0.1", CurlMock::last(CURLOPT_USERAGENT));
|
||||
}
|
||||
|
||||
public function testRequestWhenValidWithProxyShouldIssueRequestWithProxyAuthorization() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
$client = new Tinify\Client("key", NULL, "http://user:pass@localhost:8080");
|
||||
$client->request("get", "/");
|
||||
|
||||
$this->assertSame("localhost", CurlMock::last(CURLOPT_PROXY));
|
||||
$this->assertSame(8080, CurlMock::last(CURLOPT_PROXYPORT));
|
||||
$this->assertSame("user:pass", CurlMock::last(CURLOPT_PROXYUSERPWD));
|
||||
}
|
||||
|
||||
public function testRequestWithUnexpectedErrorOnceShouldReturnResponse() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"error" => "Failed!", "errno" => 2
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 201));
|
||||
|
||||
$client = new Tinify\Client("key");
|
||||
$response = $client->request("get", "/");
|
||||
$this->assertEquals("", $response->body);
|
||||
}
|
||||
|
||||
public function testRequestWithUnexpectedErrorRepeatedlyShouldThrowConnectionException() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"error" => "Failed!", "errno" => 2
|
||||
));
|
||||
|
||||
$this->setExpectedException("Tinify\ConnectionException");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithUnexpectedErrorRepeatedlyShouldThrowExceptionWithMessage() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"error" => "Failed!", "errno" => 2
|
||||
));
|
||||
|
||||
$this->setExpectedExceptionRegExp("Tinify\ConnectionException",
|
||||
"/Error while connecting: Failed! \(#2\)/");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithCurlErrorOnceShouldReturnResponse() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"errno" => 7, "error" => "Something failed", "return" => null
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 201));
|
||||
|
||||
$client = new Tinify\Client("key");
|
||||
$response = $client->request("get", "/");
|
||||
$this->assertEquals("", $response->body);
|
||||
}
|
||||
|
||||
public function testRequestWithCurlErrorRepeatedlyShouldThrowConnectionExeption() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"errno" => 7, "error" => "Something failed", "return" => null
|
||||
));
|
||||
|
||||
$this->setExpectedException("Tinify\ConnectionException");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithCurlErrorRepeatedlyShouldThrowExceptionWithMessage() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"errno" => 7, "error" => "Something failed", "return" => null
|
||||
));
|
||||
|
||||
$this->setExpectedExceptionRegExp("Tinify\ConnectionException",
|
||||
"/Error while connecting/");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithServerErrorOnceShouldReturnResponse() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 584, "body" => '{"error":"InternalServerError","message":"Oops!"}'
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 201));
|
||||
|
||||
$client = new Tinify\Client("key");
|
||||
$response = $client->request("get", "/");
|
||||
$this->assertEquals("", $response->body);
|
||||
}
|
||||
|
||||
public function testRequestWithServerErrorRepeatedlyShouldThrowServerException() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 584, "body" => '{"error":"InternalServerError","message":"Oops!"}'
|
||||
));
|
||||
|
||||
$this->setExpectedException("Tinify\ServerException");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithServerErrorRepeatedlyShouldThrowExceptionWithMessage() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 584, "body" => '{"error":"InternalServerError","message":"Oops!"}'
|
||||
));
|
||||
|
||||
$this->setExpectedExceptionRegExp("Tinify\ServerException",
|
||||
"/Oops! \(HTTP 584\/InternalServerError\)/");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithBadServerResponseOnceShouldReturnResponse() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 543, "body" => '<!-- this is not json -->'
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 201));
|
||||
|
||||
$client = new Tinify\Client("key");
|
||||
$response = $client->request("get", "/");
|
||||
$this->assertEquals("", $response->body);
|
||||
}
|
||||
|
||||
public function testRequestWithBadServerResponseRepeatedlyShouldThrowServerException() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 543, "body" => '<!-- this is not json -->'
|
||||
));
|
||||
|
||||
$this->setExpectedException("Tinify\ServerException");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithBadServerResponseRepeatedlyShouldThrowExceptionWithMessage() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 543, "body" => '<!-- this is not json -->'
|
||||
));
|
||||
|
||||
if (PHP_VERSION_ID >= 50500) {
|
||||
$this->setExpectedExceptionRegExp("Tinify\ServerException",
|
||||
"/Error while parsing response: Syntax error \(#4\) \(HTTP 543\/ParseError\)/");
|
||||
} else {
|
||||
$this->setExpectedExceptionRegExp("Tinify\ServerException",
|
||||
"/Error while parsing response: Error \(#4\) \(HTTP 543\/ParseError\)/");
|
||||
}
|
||||
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithClientErrorShouldThrowClientException() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 492, "body" => '{"error":"BadRequest","message":"Oops!"}')
|
||||
);
|
||||
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 201));
|
||||
|
||||
$this->setExpectedException("Tinify\ClientException");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithClientErrorShouldThrowExceptionWithMessage() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 492, "body" => '{"error":"BadRequest","message":"Oops!"}'
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 201));
|
||||
|
||||
$this->setExpectedExceptionRegExp("Tinify\ClientException",
|
||||
"/Oops! \(HTTP 492\/BadRequest\)/");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithBadCredentialsShouldThrowAccountException() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 401, "body" => '{"error":"Unauthorized","message":"Oops!"}'
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 201));
|
||||
|
||||
$this->setExpectedException("Tinify\AccountException");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithBadCredentialsShouldThrowExceptionWithMessage() {
|
||||
CurlMock::register("https://api.tinify.com/", array(
|
||||
"status" => 401, "body" => '{"error":"Unauthorized","message":"Oops!"}'
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 201));
|
||||
|
||||
$this->setExpectedExceptionRegExp("Tinify\AccountException",
|
||||
"/Oops! \(HTTP 401\/Unauthorized\)/");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithNoSSLCurlShouldThrowExceptionWithMessage() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
CurlMock::set_version_info_key("features", (CURL_VERSION_LIBZ | CURL_VERSION_IPV6));
|
||||
$this->setExpectedException("Tinify\ClientException",
|
||||
"Your curl version does not support secure connections");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
|
||||
public function testRequestWithOutdatedCurlShouldThrowExceptionWithMessage() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
CurlMock::set_version_info_key("version_number", 0x070f05);
|
||||
CurlMock::set_version_info_key("version", "7.15.5");
|
||||
$this->setExpectedException("Tinify\ClientException",
|
||||
"Your curl version 7.15.5 is outdated; please upgrade to 7.18.1 or higher");
|
||||
$client = new Tinify\Client("key");
|
||||
$client->request("get", "/");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
use Tinify\CurlMock;
|
||||
|
||||
class TinifyResultMetaTest extends TestCase {
|
||||
public function testWithMetadataWidthShouldReturnImageWidth() {
|
||||
$result = new Tinify\ResultMeta(array("image-width" => "100"));
|
||||
$this->assertSame(100, $result->width());
|
||||
}
|
||||
|
||||
public function testWithMetadataHeightShouldReturnImageHeight() {
|
||||
$result = new Tinify\ResultMeta(array("image-height" => "60"));
|
||||
$this->assertSame(60, $result->height());
|
||||
}
|
||||
|
||||
public function testWithMetadataLocationShouldReturnImageLocation() {
|
||||
$result = new Tinify\ResultMeta(array("location" => "https://example.com/image.png"));
|
||||
$this->assertSame("https://example.com/image.png", $result->location());
|
||||
}
|
||||
}
|
35
website-neu/api/tinify-php-master/test/TinifyResultTest.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Tinify\CurlMock;
|
||||
|
||||
class TinifyResultTest extends TestCase {
|
||||
public function testWithMetaAndDataWidthShouldReturnImageWidth() {
|
||||
$result = new Tinify\Result(array("image-width" => "100"), "image data");
|
||||
$this->assertSame(100, $result->width());
|
||||
}
|
||||
|
||||
public function testWithMetaAndDataHeightShouldReturnImageHeight() {
|
||||
$result = new Tinify\Result(array("image-height" => "60"), "image data");
|
||||
$this->assertSame(60, $result->height());
|
||||
}
|
||||
|
||||
public function testWithMetaAndDataLocationShouldReturnNull() {
|
||||
$result = new Tinify\ResultMeta(array(), "image data");
|
||||
$this->assertSame(null, $result->location());
|
||||
}
|
||||
|
||||
public function testWithMetaAndDataSizeShouldReturnContentLength() {
|
||||
$result = new Tinify\Result(array("content-length" => "450"), "image data");
|
||||
$this->assertSame(450, $result->size());
|
||||
}
|
||||
|
||||
public function testWithMetaAndDataContentTypeShouldReturnMimeType() {
|
||||
$result = new Tinify\Result(array("content-type" => "image/png"), "image data");
|
||||
$this->assertSame("image/png", $result->contentType());
|
||||
}
|
||||
|
||||
public function testWithMetaAndDataToBufferShouldReturnImageData() {
|
||||
$result = new Tinify\Result(array(), "image data");
|
||||
$this->assertSame("image data", $result->toBuffer());
|
||||
}
|
||||
}
|
318
website-neu/api/tinify-php-master/test/TinifySourceTest.php
Normal file
|
@ -0,0 +1,318 @@
|
|||
<?php
|
||||
|
||||
use Tinify\CurlMock;
|
||||
|
||||
class TinifySourceTest extends TestCase {
|
||||
private $dummyFile;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->dummyFile = __DIR__ . "/examples/dummy.png";
|
||||
}
|
||||
|
||||
public function testWithInvalidApiKeyFromFileShouldThrowAccountException() {
|
||||
Tinify\setKey("invalid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 401, "body" => '{"error":"Unauthorized","message":"Credentials are invalid"}'
|
||||
));
|
||||
|
||||
$this->setExpectedException("Tinify\AccountException");
|
||||
Tinify\Source::fromFile($this->dummyFile);
|
||||
}
|
||||
|
||||
public function testWithInvalidApiKeyFromBufferShouldThrowAccountException() {
|
||||
Tinify\setKey("invalid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 401, "body" => '{"error":"Unauthorized","message":"Credentials are invalid"}'
|
||||
));
|
||||
|
||||
$this->setExpectedException("Tinify\AccountException");
|
||||
Tinify\Source::fromBuffer("png file");
|
||||
}
|
||||
|
||||
public function testWithInvalidApiKeyFromUrlShouldThrowAccountException() {
|
||||
Tinify\setKey("invalid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 401, "body" => '{"error":"Unauthorized","message":"Credentials are invalid"}'
|
||||
));
|
||||
|
||||
$this->setExpectedException("Tinify\AccountException");
|
||||
Tinify\Source::fromUrl("http://example.com/test.jpg");
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyFromFileShouldReturnSource() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
$this->assertInstanceOf("Tinify\Source", Tinify\Source::fromFile($this->dummyFile));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyFromFileShouldReturnSourceWithData() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "compressed file"
|
||||
));
|
||||
|
||||
$this->assertSame("compressed file", Tinify\Source::fromFile($this->dummyFile)->toBuffer());
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyFromBufferShouldReturnSource() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
$this->assertInstanceOf("Tinify\Source", Tinify\Source::fromBuffer("png file"));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyFromBufferShouldReturnSourceWithData() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "compressed file"
|
||||
));
|
||||
|
||||
$this->assertSame("compressed file", Tinify\Source::fromBuffer("png file")->toBuffer());
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyFromUrlShouldReturnSource() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
$this->assertInstanceOf("Tinify\Source", Tinify\Source::fromUrl("http://example.com/testWithValidApiKey.jpg"));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyFromUrlShouldReturnSourceWithData() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "compressed file"
|
||||
));
|
||||
|
||||
$this->assertSame("compressed file", Tinify\Source::fromUrl("http://example.com/testWithValidApiKey.jpg")->toBuffer());
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyFromUrlShouldThrowExceptionIfRequestIsNotOK() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 400, "body" => '{"error":"Source not found","message":"Cannot parse URL"}'
|
||||
));
|
||||
|
||||
$this->setExpectedException("Tinify\ClientException");
|
||||
Tinify\Source::fromUrl("file://wrong");
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyResultShouldReturnResult() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201,
|
||||
"headers" => array("Location" => "https://api.tinify.com/some/location"),
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "compressed file"
|
||||
));
|
||||
|
||||
$this->assertInstanceOf("Tinify\Result", Tinify\Source::fromBuffer("png file")->result());
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyPreserveShouldReturnSource() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "copyrighted file"
|
||||
));
|
||||
|
||||
$this->assertInstanceOf("Tinify\Source", Tinify\Source::fromBuffer("png file")->preserve("copyright", "location"));
|
||||
$this->assertSame("png file", CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyPreserveShouldReturnSourceWithData() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "copyrighted file"
|
||||
));
|
||||
|
||||
$this->assertSame("copyrighted file", Tinify\Source::fromBuffer("png file")->preserve("copyright", "location")->toBuffer());
|
||||
$this->assertSame("{\"preserve\":[\"copyright\",\"location\"]}", CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyPreserveShouldReturnSourceWithDataForArray() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "copyrighted file"
|
||||
));
|
||||
|
||||
$this->assertSame("copyrighted file", Tinify\Source::fromBuffer("png file")->preserve(array("copyright", "location"))->toBuffer());
|
||||
$this->assertSame("{\"preserve\":[\"copyright\",\"location\"]}", CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyPreserveShouldIncludeOtherOptionsIfSet() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "copyrighted resized file"
|
||||
));
|
||||
|
||||
$source = Tinify\Source::fromBuffer("png file")->resize(array("width" => 400))->preserve(array("copyright", "location"));
|
||||
|
||||
$this->assertSame("copyrighted resized file", $source->toBuffer());
|
||||
$this->assertSame("{\"resize\":{\"width\":400},\"preserve\":[\"copyright\",\"location\"]}", CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyResizeShouldReturnSource() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "small file"
|
||||
));
|
||||
|
||||
$this->assertInstanceOf("Tinify\Source", Tinify\Source::fromBuffer("png file")->resize(array("width" => 400)));
|
||||
$this->assertSame("png file", CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyResizeShouldReturnSourceWithData() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "small file"
|
||||
));
|
||||
|
||||
$this->assertSame("small file", Tinify\Source::fromBuffer("png file")->resize(array("width" => 400))->toBuffer());
|
||||
$this->assertSame("{\"resize\":{\"width\":400}}", CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyStoreShouldReturnResultMeta() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201,
|
||||
"headers" => array("Location" => "https://api.tinify.com/some/location"),
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"body" => '{"store":{"service":"s3","aws_secret_access_key":"abcde"}}'
|
||||
), array("status" => 200));
|
||||
|
||||
$options = array("service" => "s3", "aws_secret_access_key" => "abcde");
|
||||
$this->assertInstanceOf("Tinify\Result", Tinify\Source::fromBuffer("png file")->store($options));
|
||||
$this->assertSame("{\"store\":{\"service\":\"s3\",\"aws_secret_access_key\":\"abcde\"}}", CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyStoreShouldReturnResultMetaWithLocation() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201,
|
||||
"headers" => array("Location" => "https://api.tinify.com/some/location"),
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"body" => '{"store":{"service":"s3"}}'
|
||||
), array(
|
||||
"status" => 201,
|
||||
"headers" => array("Location" => "https://bucket.s3.amazonaws.com/example"),
|
||||
));
|
||||
|
||||
$location = Tinify\Source::fromBuffer("png file")->store(array("service" => "s3"))->location();
|
||||
$this->assertSame("https://bucket.s3.amazonaws.com/example", $location);
|
||||
$this->assertSame("{\"store\":{\"service\":\"s3\"}}", CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyStoreShouldIncludeOtherOptionsIfSet() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201,
|
||||
"headers" => array("Location" => "https://api.tinify.com/some/location"),
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"body" => '{"resize":{"width":300},"store":{"service":"s3","aws_secret_access_key":"abcde"}}'
|
||||
), array("status" => 200));
|
||||
|
||||
$options = array("service" => "s3", "aws_secret_access_key" => "abcde");
|
||||
$this->assertInstanceOf("Tinify\Result", Tinify\Source::fromBuffer("png file")->resize(array("width" => 300))->store($options));
|
||||
$this->assertSame("{\"resize\":{\"width\":300},\"store\":{\"service\":\"s3\",\"aws_secret_access_key\":\"abcde\"}}", CurlMock::last(CURLOPT_POSTFIELDS));
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyToBufferShouldReturnImageData() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "compressed file"
|
||||
));
|
||||
|
||||
$this->assertSame("compressed file", Tinify\Source::fromBuffer("png file")->toBuffer());
|
||||
}
|
||||
|
||||
public function testWithValidApiKeyToFileShouldStoreImageData() {
|
||||
Tinify\setKey("valid");
|
||||
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
|
||||
CurlMock::register("https://api.tinify.com/some/location", array(
|
||||
"status" => 200, "body" => "compressed file"
|
||||
));
|
||||
|
||||
$path = tempnam(sys_get_temp_dir(), "tinify-php");
|
||||
Tinify\Source::fromBuffer("png file")->toFile($path);
|
||||
$this->assertSame("compressed file", file_get_contents($path));
|
||||
}
|
||||
}
|
119
website-neu/api/tinify-php-master/test/TinifyTest.php
Normal file
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
|
||||
use Tinify\CurlMock;
|
||||
|
||||
class ClientTest extends TestCase {
|
||||
private $dummyFile;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->dummyFile = __DIR__ . "/examples/dummy.png";
|
||||
}
|
||||
|
||||
public function testKeyShouldResetClientWithNewKey() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
Tinify\setKey("abcde");
|
||||
Tinify\Tinify::getClient();
|
||||
Tinify\setKey("fghij");
|
||||
$client = Tinify\Tinify::getClient();
|
||||
$client->request("get", "/");
|
||||
|
||||
$this->assertSame("api:fghij", CurlMock::last(CURLOPT_USERPWD));
|
||||
}
|
||||
|
||||
public function testAppIdentifierShouldResetClientWithNewAppIdentifier() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
Tinify\setKey("abcde");
|
||||
Tinify\setAppIdentifier("MyApp/1.0");
|
||||
Tinify\Tinify::getClient();
|
||||
Tinify\setAppIdentifier("MyApp/2.0");
|
||||
$client = Tinify\Tinify::getClient();
|
||||
$client->request("get", "/");
|
||||
|
||||
$this->assertSame(Tinify\Client::userAgent() . " MyApp/2.0", CurlMock::last(CURLOPT_USERAGENT));
|
||||
}
|
||||
|
||||
public function testProxyShouldResetClientWithNewProxy() {
|
||||
CurlMock::register("https://api.tinify.com/", array("status" => 200));
|
||||
Tinify\setKey("abcde");
|
||||
Tinify\setProxy("http://localhost");
|
||||
Tinify\Tinify::getClient();
|
||||
Tinify\setProxy("http://user:pass@localhost:8080");
|
||||
$client = Tinify\Tinify::getClient();
|
||||
$client->request("get", "/");
|
||||
|
||||
$this->assertSame(Tinify\Client::userAgent() . " MyApp/2.0", CurlMock::last(CURLOPT_USERAGENT));
|
||||
}
|
||||
|
||||
public function testClientWithKeyShouldReturnClient() {
|
||||
Tinify\setKey("abcde");
|
||||
$this->assertInstanceOf("Tinify\Client", Tinify\Tinify::getClient());
|
||||
}
|
||||
|
||||
public function testClientWithoutKeyShouldThrowException() {
|
||||
$this->setExpectedException("Tinify\AccountException");
|
||||
Tinify\Tinify::getClient();
|
||||
}
|
||||
|
||||
public function testClientWithInvalidProxyShouldThrowException() {
|
||||
$this->setExpectedException("Tinify\ConnectionException");
|
||||
Tinify\setKey("abcde");
|
||||
Tinify\setProxy("http-bad-url");
|
||||
Tinify\Tinify::getClient();
|
||||
}
|
||||
|
||||
public function testSetClientShouldReplaceClient() {
|
||||
Tinify\setKey("abcde");
|
||||
Tinify\Tinify::setClient("foo");
|
||||
$this->assertSame("foo", Tinify\Tinify::getClient());
|
||||
}
|
||||
|
||||
public function testValidateWithValidKeyShouldReturnTrue() {
|
||||
Tinify\setKey("valid");
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 400, "body" => '{"error":"Input missing","message":"No input"}'
|
||||
));
|
||||
$this->assertTrue(Tinify\validate());
|
||||
}
|
||||
|
||||
public function testValidateWithLimitedKeyShouldReturnTrue() {
|
||||
Tinify\setKey("invalid");
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 429, "body" => '{"error":"Too many requests","message":"Your monthly limit has been exceeded"}'
|
||||
));
|
||||
$this->assertTrue(Tinify\validate());
|
||||
}
|
||||
|
||||
public function testValidateWithErrorShouldThrowException() {
|
||||
Tinify\setKey("invalid");
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 401, "body" => '{"error":"Unauthorized","message":"Credentials are invalid"}'
|
||||
));
|
||||
$this->setExpectedException("Tinify\AccountException");
|
||||
Tinify\validate();
|
||||
}
|
||||
|
||||
public function testFromFileShouldReturnSource() {
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
Tinify\setKey("valid");
|
||||
$this->assertInstanceOf("Tinify\Source", Tinify\fromFile($this->dummyFile));
|
||||
}
|
||||
|
||||
public function testFromBufferShouldReturnSource() {
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
Tinify\setKey("valid");
|
||||
$this->assertInstanceOf("Tinify\Source", Tinify\fromBuffer("png file"));
|
||||
}
|
||||
|
||||
public function testFromUrlShouldReturnSource() {
|
||||
CurlMock::register("https://api.tinify.com/shrink", array(
|
||||
"status" => 201, "headers" => array("Location" => "https://api.tinify.com/some/location")
|
||||
));
|
||||
Tinify\setKey("valid");
|
||||
$this->assertInstanceOf("Tinify\Source", Tinify\fromUrl("http://example.com/test.jpg"));
|
||||
}
|
||||
}
|
191
website-neu/api/tinify-php-master/test/curl_mock.php
Normal file
|
@ -0,0 +1,191 @@
|
|||
<?php
|
||||
|
||||
namespace Tinify;
|
||||
|
||||
class CurlMockException extends Exception {
|
||||
}
|
||||
|
||||
class CurlMock {
|
||||
private static $defaultVersion = array(
|
||||
"version_number" => 471808,
|
||||
"version" => "7.51.0",
|
||||
"features" => 951197,
|
||||
);
|
||||
|
||||
private static $urls = array();
|
||||
private static $requests = array();
|
||||
private static $version = array();
|
||||
|
||||
public $options = array();
|
||||
public $response;
|
||||
public $closed = false;
|
||||
|
||||
public static function version_info() {
|
||||
return self::$version;
|
||||
}
|
||||
|
||||
public static function set_version_info_key($key, $value) {
|
||||
self::$version[$key] = $value;
|
||||
}
|
||||
|
||||
public static function register($url, $request, $response = NULL) {
|
||||
if (!$response) {
|
||||
$response = $request;
|
||||
$request = NULL;
|
||||
}
|
||||
|
||||
if (!isset(self::$urls[$url])) {
|
||||
self::$urls[$url] = array();
|
||||
}
|
||||
|
||||
array_push(self::$urls[$url], array($request, $response));
|
||||
}
|
||||
|
||||
public static function reset() {
|
||||
self::$requests = array();
|
||||
self::$urls = array();
|
||||
self::$version = self::$defaultVersion;
|
||||
}
|
||||
|
||||
public static function last_has($key) {
|
||||
$lastReq = self::$requests[count(self::$requests) - 1];
|
||||
return array_key_exists($key, $lastReq->options);
|
||||
}
|
||||
|
||||
public static function last($key = null) {
|
||||
$lastReq = self::$requests[count(self::$requests) - 1];
|
||||
if ($key) {
|
||||
return $lastReq->options[$key];
|
||||
} else {
|
||||
return $lastReq;
|
||||
}
|
||||
}
|
||||
|
||||
public function close() {
|
||||
$this->closed = true;
|
||||
}
|
||||
|
||||
public function exec() {
|
||||
if ($this->closed) {
|
||||
throw new CurlMockException("Curl already closed");
|
||||
}
|
||||
array_push(self::$requests, $this);
|
||||
|
||||
$queue = &self::$urls[$this->options[CURLOPT_URL]];
|
||||
list($this->request, $this->response) = $queue[0];
|
||||
|
||||
/* Keep last request as fallback. */
|
||||
if (count($queue) > 1) array_shift($queue);
|
||||
|
||||
if ($this->request) {
|
||||
if ($this->request["body"]) {
|
||||
if ($this->options[CURLOPT_POSTFIELDS] != $this->request["body"]) {
|
||||
throw new Exception("Body '" . $this->options[CURLOPT_POSTFIELDS] .
|
||||
"' does not match expected '" . $this->request["body"] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->response["headers"])) {
|
||||
$headers = "";
|
||||
foreach ($this->response["headers"] as $header => $value) {
|
||||
$headers .= $header . ": " . $value . "\r\n";
|
||||
}
|
||||
$this->response["headers"] = $headers . "\r\n";
|
||||
} else {
|
||||
$this->response["headers"] = "\r\n";
|
||||
}
|
||||
|
||||
if (!isset($this->response["body"])) {
|
||||
$this->response["body"] = "";
|
||||
}
|
||||
|
||||
if (array_key_exists("return", $this->response)) {
|
||||
return $this->response["return"];
|
||||
} else if (isset($this->response["status"])) {
|
||||
return $this->response["headers"] . $this->response["body"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function setopt_array($array) {
|
||||
if ($this->closed) {
|
||||
throw new CurlMockException("Curl already closed");
|
||||
}
|
||||
foreach ($array as $key => $value) {
|
||||
$this->options[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function setopt($key, $value) {
|
||||
if ($this->closed) {
|
||||
throw new CurlMockException("Curl already closed");
|
||||
}
|
||||
$this->options[$key] = $value;
|
||||
}
|
||||
|
||||
public function getinfo($key) {
|
||||
if ($this->closed) {
|
||||
throw new CurlMockException("Curl already closed");
|
||||
}
|
||||
switch ($key) {
|
||||
case CURLINFO_HTTP_CODE:
|
||||
return isset($this->response["status"]) ? $this->response["status"] : 0;
|
||||
case CURLINFO_HEADER_SIZE:
|
||||
return strlen($this->response["headers"]);
|
||||
default:
|
||||
throw new Exception("Bad key $key");
|
||||
}
|
||||
}
|
||||
|
||||
public function error() {
|
||||
if ($this->closed) {
|
||||
throw new CurlMockException("Curl already closed");
|
||||
}
|
||||
return $this->response["error"];
|
||||
}
|
||||
|
||||
public function errno() {
|
||||
if ($this->closed) {
|
||||
throw new CurlMockException("Curl already closed");
|
||||
}
|
||||
return $this->response["errno"];
|
||||
}
|
||||
}
|
||||
|
||||
function curl_version() {
|
||||
return CurlMock::version_info();
|
||||
}
|
||||
|
||||
function curl_init() {
|
||||
return new CurlMock();
|
||||
}
|
||||
|
||||
function curl_exec($mock) {
|
||||
return $mock->exec();
|
||||
}
|
||||
|
||||
function curl_close($mock) {
|
||||
$mock->close();
|
||||
}
|
||||
|
||||
function curl_setopt_array($mock, $array) {
|
||||
return $mock->setopt_array($array);
|
||||
}
|
||||
|
||||
function curl_setopt($mock, $key, $value) {
|
||||
return $mock->setopt($key, $value);
|
||||
}
|
||||
|
||||
function curl_getinfo($mock, $key) {
|
||||
return $mock->getinfo($key);
|
||||
}
|
||||
|
||||
function curl_error($mock) {
|
||||
return $mock->error();
|
||||
}
|
||||
|
||||
function curl_errno($mock) {
|
||||
return $mock->errno();
|
||||
}
|
BIN
website-neu/api/tinify-php-master/test/examples/voormedia.png
Normal file
After Width: | Height: | Size: 17 KiB |
16
website-neu/api/tinify-php-master/test/helper.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
require_once("curl_mock.php");
|
||||
require_once("vendor/autoload.php");
|
||||
|
||||
class TestCase extends \PHPUnit_Framework_TestCase {
|
||||
function setUp() {
|
||||
Tinify\CurlMock::reset();
|
||||
Tinify\setKey(NULL);
|
||||
TInify\setProxy(NULL);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
Tinify\CurlMock::reset();
|
||||
}
|
||||
}
|
79
website-neu/api/tinify-php-master/test/integration.php
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
if (!getenv("TINIFY_KEY")) {
|
||||
exit("Set the TINIFY_KEY environment variable.\n");
|
||||
}
|
||||
|
||||
class ClientIntegrationTest extends PHPUnit_Framework_TestCase {
|
||||
static private $optimized;
|
||||
|
||||
static public function setUpBeforeClass() {
|
||||
\Tinify\setKey(getenv("TINIFY_KEY"));
|
||||
\Tinify\setProxy(getenv("TINIFY_PROXY"));
|
||||
\Tinify\validate();
|
||||
|
||||
$unoptimizedPath = __DIR__ . "/examples/voormedia.png";
|
||||
self::$optimized = \Tinify\fromFile($unoptimizedPath);
|
||||
}
|
||||
|
||||
public function testShouldCompressFromFile() {
|
||||
$path = tempnam(sys_get_temp_dir(), "tinify-php");
|
||||
self::$optimized->toFile($path);
|
||||
|
||||
$size = filesize($path);
|
||||
$contents = fread(fopen($path, "rb"), $size);
|
||||
|
||||
$this->assertGreaterThan(1000, $size);
|
||||
$this->assertLessThan(1500, $size);
|
||||
|
||||
/* width == 137 */
|
||||
$this->assertContains("\0\0\0\x89", $contents);
|
||||
$this->assertNotContains("Copyright Voormedia", $contents);
|
||||
}
|
||||
|
||||
public function testShouldCompressFromUrl() {
|
||||
$path = tempnam(sys_get_temp_dir(), "tinify-php");
|
||||
$source = \Tinify\fromUrl("https://raw.githubusercontent.com/tinify/tinify-php/master/test/examples/voormedia.png");
|
||||
$source->toFile($path);
|
||||
|
||||
$size = filesize($path);
|
||||
$contents = fread(fopen($path, "rb"), $size);
|
||||
|
||||
$this->assertGreaterThan(1000, $size);
|
||||
$this->assertLessThan(1500, $size);
|
||||
|
||||
/* width == 137 */
|
||||
$this->assertContains("\0\0\0\x89", $contents);
|
||||
$this->assertNotContains("Copyright Voormedia", $contents);
|
||||
}
|
||||
|
||||
public function testShouldResize() {
|
||||
$path = tempnam(sys_get_temp_dir(), "tinify-php");
|
||||
self::$optimized->resize(array("method" => "fit", "width" => 50, "height" => 20))->toFile($path);
|
||||
|
||||
$size = filesize($path);
|
||||
$contents = fread(fopen($path, "rb"), $size);
|
||||
|
||||
$this->assertGreaterThan(500, $size);
|
||||
$this->assertLessThan(1000, $size);
|
||||
|
||||
/* width == 50 */
|
||||
$this->assertContains("\0\0\0\x32", $contents);
|
||||
$this->assertNotContains("Copyright Voormedia", $contents);
|
||||
}
|
||||
|
||||
public function testShouldPreserveMetadata() {
|
||||
$path = tempnam(sys_get_temp_dir(), "tinify-php");
|
||||
self::$optimized->preserve("copyright", "creation")->toFile($path);
|
||||
|
||||
$size = filesize($path);
|
||||
$contents = fread(fopen($path, "rb"), $size);
|
||||
|
||||
$this->assertGreaterThan(1000, $size);
|
||||
$this->assertLessThan(2000, $size);
|
||||
|
||||
/* width == 137 */
|
||||
$this->assertContains("\0\0\0\x89", $contents);
|
||||
$this->assertContains("Copyright Voormedia", $contents);
|
||||
}
|
||||
}
|
17
website-neu/api/tinify-php-master/update-cacert.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
dir=lib/data
|
||||
|
||||
cert=0
|
||||
curl https://curl.haxx.se/ca/cacert.pem | while read line; do
|
||||
if [ "-----BEGIN CERTIFICATE-----" == "$line" ]; then
|
||||
cert=1
|
||||
echo $line
|
||||
elif [ "-----END CERTIFICATE-----" == "$line" ]; then
|
||||
cert=0
|
||||
echo $line
|
||||
else
|
||||
if [ $cert == 1 ]; then
|
||||
echo $line
|
||||
fi
|
||||
fi
|
||||
done > $dir/cacert.pem
|
14
website-neu/dbcon.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
$SQLHost = "db.a-hoefler.eu";
|
||||
$SQLUser = "root";
|
||||
$SQLPasswort = "bqCdUHZYgHeTd583kZ3cMVd9";
|
||||
$SQLDatenbank = "jensmemes";
|
||||
$con = mysqli_connect($SQLHost, $SQLUser, $SQLPasswort, $SQLDatenbank);
|
||||
|
||||
// Check connection
|
||||
if (mysqli_connect_errno())
|
||||
{
|
||||
echo "<b style='color: #9c4b4b; text-decoration: underline;'>Failed to connect to <i >" .$SQLHost."</i> </b> :: " . mysqli_connect_error();
|
||||
}
|
||||
?>
|
124
website-neu/home/delete.php
Normal file
|
@ -0,0 +1,124 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>HOME | JensMemes v2</title>
|
||||
<meta charset="utf-8" />
|
||||
<!-- Das neueste kompilierte und minimierte CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
||||
|
||||
<!-- Optionales Theme -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
|
||||
|
||||
<!-- Das neueste kompilierte und minimierte JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
||||
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link id="theme" rel="stylesheet" href="/themes/llama.css" />
|
||||
<script defer src="/script/modal.js"></script>
|
||||
<script defer src="/script/button.js"></script>
|
||||
<script defer src="/script/switcher.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="">
|
||||
|
||||
<div class="modal" id="modal">
|
||||
<div class="modal-header">
|
||||
<div class="title">Home</div>
|
||||
<button data-close-button class="close-button">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
Im Home-Bereich kannst du deine Memes verwalten.
|
||||
|
||||
<br><b>Made by</b>
|
||||
<ul>
|
||||
<li><a href="https://itbyhf.eu">ITbyHF</a> - Website/ Llama Theme</li>
|
||||
<li><a href="http://tilera.xyz/">tilera</a> - Hosting/ Old Theme</li>
|
||||
<li><a href="https://twitter.com/LordMZTE">LordMZTE</a> - Theme 2 und Theme Switch</li>
|
||||
<li><a href="https://jonasled.de/">jonasled</a> - Discord Bot / Dark Theme</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="overlay"></div>
|
||||
<div>
|
||||
<form action="#" method="post" enctype="multipart/form-data">
|
||||
<input type='submit' name='logout' class="btn-logout" value=''>
|
||||
</form>
|
||||
<?php
|
||||
if (isset($_POST['logout'])) {
|
||||
setcookie("token", "", time() - 3600);
|
||||
header('Location: ./');
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
echo ' <form action="#" method="post" enctype="multipart/form-data">
|
||||
<input type=\'submit\' name=\'home\' class="btn-home" value=\'\'>
|
||||
</form>
|
||||
';
|
||||
if (isset($_POST['home'])) {
|
||||
setcookie("token", "", time() - 3600);
|
||||
header('Location: /');
|
||||
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<h2>
|
||||
<center></center>
|
||||
</h2>
|
||||
<div class="bar-main">
|
||||
<button data-modal-target="#modal" class="btn-modal"></button>
|
||||
<div id="themediv">
|
||||
<p>Theme:</p>
|
||||
<select name="Themes" id="themeswitcher">
|
||||
<option value="llama">Llama</option>
|
||||
<option value="light">LordMZTE</option>
|
||||
<option value="old">Old</option>
|
||||
<option value="retro">Retro</option>
|
||||
<option value="dark">Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
<h2>Meme Löschen</h2><br><br>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
include "../dbcon.php";
|
||||
echo 'Willst du wirklich folgendes Meme löschen? :<br>
|
||||
<div class="kasten">
|
||||
<img src="/'.$_GET['m'].' "class="Bilder_">
|
||||
</div>
|
||||
|
||||
';
|
||||
|
||||
?>
|
||||
<form action="#" method="post">
|
||||
<input type="submit" name="yes" class="btn btn-danger" value=" Ja ">
|
||||
</form>
|
||||
<form action="#" method="post">
|
||||
<input type="submit" name="no" class="btn btn-success" value="Abbrechen ">
|
||||
</form>
|
||||
<?php
|
||||
if(isset($_POST['no'])){
|
||||
header('Location: /home');
|
||||
}
|
||||
if(isset($_POST['yes'])){
|
||||
$m = $_GET['m'];
|
||||
$sql = "DELETE FROM images WHERE path='$m'";
|
||||
$result = mysqli_query($con, $sql);
|
||||
if($result){
|
||||
echo "Datei aus Datenbank gelöscht.";
|
||||
}
|
||||
if(unlink('../'.$m)){
|
||||
echo 'Datei von Server gelöscht.';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
27
website-neu/home/index.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>HOME | JensMemes v2</title>
|
||||
<meta charset="utf-8" />
|
||||
<!-- Das neueste kompilierte und minimierte CSS -->
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="">
|
||||
|
||||
<?php
|
||||
|
||||
if(!empty($_COOKIE['token'])){
|
||||
include('site.php');
|
||||
} else{
|
||||
header('location:../index.php');
|
||||
echo "UMLEITUNG! GG";
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
121
website-neu/home/site.php
Normal file
|
@ -0,0 +1,121 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>HOME | JensMemes v2</title>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link id="theme" rel="stylesheet" href="/themes/llama.css" />
|
||||
<script defer src="/script/modal.js"></script>
|
||||
<script defer src="/script/button.js"></script>
|
||||
<script defer src="/script/switcher.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="">
|
||||
|
||||
<div class="modal" id="modal">
|
||||
<div class="modal-header">
|
||||
<div class="title">Home</div>
|
||||
<button data-close-button class="close-button">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
Im Home-Bereich kannst du deine Memes verwalten.
|
||||
|
||||
<br><b>Made by</b>
|
||||
<ul>
|
||||
<li><a href="https://itbyhf.eu">ITbyHF</a> - Website/ Llama Theme</li>
|
||||
<li><a href="http://tilera.xyz/">tilera</a> - Hosting/ Old Theme</li>
|
||||
<li><a href="https://twitter.com/LordMZTE">LordMZTE</a> - Theme 2 und Theme Switch</li>
|
||||
<li><a href="https://jonasled.de/">jonasled</a> - Discord Bot / Dark Theme</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="overlay"></div>
|
||||
<div>
|
||||
<form action="#" method="post" enctype="multipart/form-data">
|
||||
<input type='submit' name='logout' class="btn-logout" value=''>
|
||||
</form>
|
||||
<?php
|
||||
if (isset($_POST['logout'])) {
|
||||
setcookie("token", "", time() - 3600);
|
||||
header('Location: ./');
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
echo ' <form action="#" method="post" enctype="multipart/form-data">
|
||||
<input type=\'submit\' name=\'home\' class="btn-home" value=\'\'>
|
||||
</form>
|
||||
';
|
||||
if (isset($_POST['home'])) {
|
||||
setcookie("token", "", time() - 3600);
|
||||
header('Location: /');
|
||||
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<h2>
|
||||
<center></center>
|
||||
</h2>
|
||||
<div class="bar-main">
|
||||
<button data-modal-target="#modal" class="btn-modal"></button>
|
||||
<div id="themediv">
|
||||
<p>Theme:</p>
|
||||
<select name="Themes" id="themeswitcher">
|
||||
<option value="llama">Llama</option>
|
||||
<option value="light">LordMZTE</option>
|
||||
<option value="old">Old</option>
|
||||
<option value="retro">Retro</option>
|
||||
<option value="dark">Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
<h2>Home</h2><br><br>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<?php
|
||||
include "../dbcon.php";
|
||||
$sqlJens = "SELECT * FROM images";
|
||||
$db_ergJens = mysqli_query( $con, $sqlJens);
|
||||
if ( ! $db_ergJens )
|
||||
{
|
||||
die('Invalid Request ' . mysqli_error());
|
||||
}
|
||||
while ($zeile = mysqli_fetch_array( $db_ergJens, MYSQLI_ASSOC))
|
||||
{
|
||||
if(true){
|
||||
$ext = strtolower(pathinfo($zeile['path'], PATHINFO_EXTENSION));
|
||||
|
||||
if($ext=="mp4"){
|
||||
echo '
|
||||
|
||||
<div class="kasten">
|
||||
<a href="/'.$zeile[path].'"><video src="/'.$zeile[path].'" controls class="Videos_"></video> </a>
|
||||
</div>
|
||||
|
||||
';
|
||||
} else if($ext=="png" || $ext=="jpg" ||$ext=="jpeg"||$ext=="gif" ){
|
||||
echo '
|
||||
<div class="kasten">
|
||||
<a href="/'.$zeile[path].'"><img class="Bilder_" src="/'.$zeile[path].'"></a>
|
||||
<a href="delete.php?m='.$zeile[path].'">Löschen</a>
|
||||
</div>
|
||||
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
mysqli_free_result( $db_ergJens );
|
||||
?>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
BIN
website-neu/img/bg-img.jpg
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
website-neu/img/bg.png
Normal file
After Width: | Height: | Size: 100 KiB |
BIN
website-neu/img/favicon.ico
Normal file
After Width: | Height: | Size: 122 KiB |
BIN
website-neu/img/head.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
website-neu/img/home.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
website-neu/img/info.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
website-neu/img/logout.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
website-neu/img/upload.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
12
website-neu/incl/clientIP.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
include ('../dbcon.php');
|
||||
|
||||
$clientIP =$_SERVER['REMOTE_ADDR'];
|
||||
$tk = $_COOKIE['token'];
|
||||
$sql = "UPDATE `token` SET `latest-ip` = '$clientIP' WHERE `token` = '$tk';
|
||||
";
|
||||
if(!mysqli_query($con, $sql)){
|
||||
echo "Err_ Sending Client IP".mysqli_error($con);
|
||||
}
|
||||
?>
|
143
website-neu/incl/img.php
Normal file
|
@ -0,0 +1,143 @@
|
|||
<?php
|
||||
include ('../dbcon.php');
|
||||
?>
|
||||
<h2>JensMemes</h2>
|
||||
<?php
|
||||
$sqlJens = "SELECT * FROM images";
|
||||
$db_ergJens = mysqli_query( $con, $sqlJens);
|
||||
if ( ! $db_ergJens )
|
||||
{
|
||||
die('Ungültige Abfrage: ' . mysqli_error());
|
||||
}
|
||||
while ($zeile = mysqli_fetch_array( $db_ergJens, MYSQLI_ASSOC))
|
||||
{
|
||||
if($zeile[cat]=="jens"){
|
||||
$ext = strtolower(pathinfo($zeile['path'], PATHINFO_EXTENSION));
|
||||
|
||||
if($ext=="mp4"){
|
||||
echo '
|
||||
|
||||
<div class="kasten">
|
||||
<a href="'.$zeile[path].'"><video src="'.$zeile[path].'" controls class="Videos_"></video> </a>
|
||||
</div>
|
||||
|
||||
';
|
||||
} else if($ext=="png" || $ext=="jpg" ||$ext=="jpeg"||$ext=="gif" ){
|
||||
echo '
|
||||
<div class="kasten">
|
||||
<a href="'.$zeile[path].'"><img class="Bilder_" src="'.$zeile[path].'"></a>
|
||||
</div>
|
||||
|
||||
';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
mysqli_free_result( $db_ergJens );
|
||||
?>
|
||||
<h2>randomMemes</h2>
|
||||
<?php
|
||||
$sqlrandom = "SELECT * FROM images";
|
||||
$db_ergrandom = mysqli_query( $con, $sqlrandom);
|
||||
if ( ! $db_ergrandom )
|
||||
{
|
||||
die('Ungültige Abfrage: ' . mysqli_error());
|
||||
}
|
||||
while ($zeile = mysqli_fetch_array( $db_ergrandom, MYSQLI_ASSOC))
|
||||
{
|
||||
if($zeile[cat]=="random"){
|
||||
$ext = strtolower(pathinfo($zeile['path'], PATHINFO_EXTENSION));
|
||||
|
||||
if($ext=="mp4"){
|
||||
echo '
|
||||
|
||||
<div class="kasten">
|
||||
<a href="'.$zeile[path].'"><video src="'.$zeile[path].'" controls class="Videos_"></video> </a>
|
||||
</div>
|
||||
|
||||
';
|
||||
} else if($ext=="png" || $ext=="jpg" ||$ext=="jpeg"||$ext=="gif" ){
|
||||
echo '
|
||||
<div class="kasten">
|
||||
<a href="'.$zeile[path].'"><img class="Bilder_" src="'.$zeile[path].'"></a>
|
||||
</div>
|
||||
|
||||
';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
mysqli_free_result( $db_ergrandom );
|
||||
?>
|
||||
<h2>realtoxMemes</h2>
|
||||
<?php
|
||||
$sqlrealtox = "SELECT * FROM images";
|
||||
$db_ergrealtox = mysqli_query( $con, $sqlrealtox);
|
||||
if ( ! $db_ergrealtox )
|
||||
{
|
||||
die('Ungültige Abfrage: ' . mysqli_error());
|
||||
}
|
||||
while ($zeile = mysqli_fetch_array( $db_ergrealtox, MYSQLI_ASSOC))
|
||||
{
|
||||
if($zeile[cat]=="realtox"){
|
||||
$ext = strtolower(pathinfo($zeile['path'], PATHINFO_EXTENSION));
|
||||
|
||||
if($ext=="mp4"){
|
||||
echo '
|
||||
|
||||
<div class="kasten">
|
||||
<a href="'.$zeile[path].'"><video src="'.$zeile[path].'" controls class="Videos_"></video> </a>
|
||||
</div>
|
||||
|
||||
';
|
||||
} else if($ext=="png" || $ext=="jpg" ||$ext=="jpeg"||$ext=="gif" ){
|
||||
echo '
|
||||
<div class="kasten">
|
||||
<a href="'.$zeile[path].'"><img class="Bilder_" src="'.$zeile[path].'"></a>
|
||||
</div>
|
||||
|
||||
';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
mysqli_free_result( $db_ergrealtox );
|
||||
?>
|
||||
<h2>hendrikMemes</h2>
|
||||
<?php
|
||||
$sqlhendrik = "SELECT * FROM images";
|
||||
$db_erghendrik = mysqli_query( $con, $sqlhendrik);
|
||||
if ( ! $db_erghendrik )
|
||||
{
|
||||
die('Ungültige Abfrage: ' . mysqli_error());
|
||||
}
|
||||
while ($zeile = mysqli_fetch_array( $db_erghendrik, MYSQLI_ASSOC))
|
||||
{
|
||||
if($zeile[cat]=="hendrik"){
|
||||
$ext = strtolower(pathinfo($zeile['path'], PATHINFO_EXTENSION));
|
||||
|
||||
if($ext=="mp4"){
|
||||
echo '
|
||||
|
||||
<div class="kasten">
|
||||
<a href="'.$zeile[path].'"><video src="'.$zeile[path].'" controls class="Videos_"></video> </a>
|
||||
</div>
|
||||
|
||||
';
|
||||
} else if($ext=="png" || $ext=="jpg" ||$ext=="jpeg"||$ext=="gif" ){
|
||||
echo '
|
||||
<div class="kasten">
|
||||
<a href="'.$zeile[path].'"><img class="Bilder_" src="'.$zeile[path].'"></a>
|
||||
</div>
|
||||
|
||||
';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
mysqli_free_result( $db_erghendrik );
|
||||
?>
|
51
website-neu/incl/upload.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
if (isset($_POST['submit'])) {
|
||||
include('uploadOK.php');
|
||||
if(empty($tokencookie)) {
|
||||
$tokencookie = $_POST['token'];
|
||||
}
|
||||
$home_dir = "images/" . md5($tokencookie) . "/";
|
||||
mkdir($home_dir);
|
||||
|
||||
$resultMaxUpl = mysqli_query($con, "select * from token WHERE token='$tokencookie' OR token='$tokenpost'") or die('Error In Session');
|
||||
$rowMaxUpl = mysqli_fetch_array($resultMaxUpl);
|
||||
$MaxUpl = $rowMaxUpl['uploadsLast24H'];
|
||||
$MaxUpl++;
|
||||
$sqlMaxUpl = "UPDATE token SET uploadsLast24H='$MaxUpl' WHERE token='$tokencookie' OR token='$tokenpost'";
|
||||
mysqli_query($con, $sqlMaxUpl);
|
||||
|
||||
|
||||
$resultToken=mysqli_query($con, "select * from token WHERE token='$tokencookie' OR token='$tokenpost'")or die('ERR_resultToken');
|
||||
$rowToken=mysqli_fetch_array($resultToken);
|
||||
|
||||
|
||||
|
||||
if ($uploadOK) {
|
||||
if ($MaxUpl <= 20) {
|
||||
$countfiles = count($_FILES['file']['name']);
|
||||
for ($i = 0; $i < $countfiles; $i++) {
|
||||
$filename = $_FILES['file']['name'][$i];
|
||||
move_uploaded_file($_FILES['file']['tmp_name'][$i], $home_dir . $filename);
|
||||
|
||||
$memecat = $_POST['type'];
|
||||
$user = $rowToken['name'];
|
||||
$path = $home_dir.$filename;
|
||||
$sqlType = "INSERT INTO images (user, path, cat) VALUES ('$user', '$path', '$memecat')";
|
||||
$resultType = mysqli_query($con,$sqlType);
|
||||
if(!$resultType){
|
||||
echo 'Error ' .mysqli_error($con);
|
||||
}
|
||||
|
||||
}
|
||||
if (empty($_COOKIE['token'])) {
|
||||
$setCookie = $_POST['token'];
|
||||
setcookie("token", $setCookie, time() + (3600 * 720));
|
||||
echo "Cookie mit Inhalt gesetzt: " . $setCookie;
|
||||
} else {
|
||||
}
|
||||
} else echo "Heutiges Upload-Limit erreicht!";
|
||||
} else {
|
||||
echo "Unautorized!";
|
||||
}
|
||||
}
|
||||
?>
|
22
website-neu/incl/uploadOK.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
include('../dbcon.php');
|
||||
|
||||
|
||||
$tokencookie = $_COOKIE['token'];
|
||||
$resulttoken=mysqli_query($con, "select * from token WHERE token='$tokencookie'")or die('Error In Session');
|
||||
$rowtoken=mysqli_fetch_array($resulttoken);
|
||||
|
||||
$tokenpost = $_POST['token'];
|
||||
$resultpost=mysqli_query($con, "select * from token WHERE token='$tokenpost'")or die('Error In Session');
|
||||
$rowpost=mysqli_fetch_array($resultpost);
|
||||
|
||||
|
||||
if(!empty($rowtoken) || !empty($rowpost)){
|
||||
$uploadOK = true;
|
||||
//echo "<b>Authenticated.</b>";
|
||||
}else{
|
||||
$uploadOK = false;
|
||||
echo "<b>unauthenticated.</b>";
|
||||
}
|
||||
|
||||
?>
|
115
website-neu/index.php
Normal file
|
@ -0,0 +1,115 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>JensMemes v2</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link id="theme" rel="stylesheet" href="themes/llama.css" />
|
||||
<script defer src="/script/modal.js"></script>
|
||||
<script defer src="/script/button.js"></script>
|
||||
<script defer src="/script/switcher.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="">
|
||||
|
||||
<div class="modal" id="modal">
|
||||
<div class="modal-header">
|
||||
<div class="title">Informationen</div>
|
||||
<button data-close-button class="close-button">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Das Token für das Login kannst du im Discord von Jens bzw. in Anvilcraft -Discord über den Befehl !register erhalten. Es wird nach der Eingabe für 30 Tage im Browser gespeichert - dannach muss es neu eingegeben werden. Durch den Logout-Button rechts kann mann es löschen.<br><b>Made by</b>
|
||||
<ul>
|
||||
<li><a href="https://itbyhf.eu">ITbyHF</a> - Website</li>
|
||||
<li><a href="http://tilera.xyz/">tilera</a> - Hosting</li>
|
||||
<li><a href="https://twitter.com/LordMZTE">LordMZTE</a> - Theme 2 und Theme Switch</li>
|
||||
<li><a href="https://jonasled.de/">jonasled</a> - Discord Bot</li>
|
||||
<li><a href="https://www.twitch.tv/knautschzon3">Knautschzon3</a> - Website</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="overlay"></div>
|
||||
<div class="col-lg m-auto">
|
||||
<form action="#" method="post" enctype="multipart/form-data">
|
||||
<input type='submit' name='logout' class="btn-logout" value=''>
|
||||
</form>
|
||||
<?php
|
||||
if (isset($_POST['logout'])) {
|
||||
setcookie("token", "", time() - 3600);
|
||||
header('Location: ./');
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($_COOKIE['token'])){
|
||||
echo ' <form action="#" method="post" enctype="multipart/form-data">
|
||||
<input type="submit"name="home" class="btn-home" value="">
|
||||
</form>
|
||||
';
|
||||
if (isset($_POST['home'])) {
|
||||
header('Location: /home');
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<h2>
|
||||
<center></center>
|
||||
</h2>
|
||||
<div class="bar-main">
|
||||
<button data-modal-target="#modal" class="btn-modal"></button>
|
||||
<div id="themediv">
|
||||
<p>Theme:</p>
|
||||
<select name="Themes" id="themeswitcher">
|
||||
<option value="llama">Llama</option>
|
||||
<option value="light">LordMZTE</option>
|
||||
<option value="old">Old</option>
|
||||
<option value="retro">Retro</option>
|
||||
<option value="dark">Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
$tokencookie = $_COOKIE['token'];
|
||||
if (!empty($tokencookie)) {
|
||||
echo '<b style="color:red;">Authentifiziert</b>';
|
||||
} ?>
|
||||
<form method='post' action='#' enctype='multipart/form-data'>
|
||||
<input type="file" id="real-file" hidden="hidden" name="file[]" multiple="" />
|
||||
<button type="button" id="custom-button">Browse...</button>
|
||||
<span id="custom-text"></span>
|
||||
<?php
|
||||
if (empty($tokencookie)) {
|
||||
echo '
|
||||
<input type="text" name="token" id="token" placeholder="Token">';
|
||||
} else {
|
||||
}
|
||||
?>
|
||||
<label for="type">Memetype</label>
|
||||
<select id="type" name="type">
|
||||
<option value="jens">JensMeme</option>
|
||||
<option value="hendrik">HendrikMeme</option>
|
||||
<option value="realtox">RealtoxMeme</option>
|
||||
<option value="random">RandomMeme</option>
|
||||
</select>
|
||||
|
||||
<center><input type='submit' name='submit' id="btn-close-CSS" value=''></center>
|
||||
</form>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
|
||||
include "dbcon.php";
|
||||
include "incl/uploadOK.php";
|
||||
include "incl/upload.php";
|
||||
include 'incl/img.php';
|
||||
include 'incl/clientIP.php';
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
12
website-neu/random.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
$files = glob("images/*/*");
|
||||
$random = rand(0, count($files) - 1);
|
||||
$file = $files[$random];
|
||||
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
if ($ext == "mp4") {
|
||||
echo "<a href='$file'><video src='$file' controls ></video></a>";
|
||||
} else {
|
||||
echo "<a href='$file'><img src='$file' /></a>";
|
||||
}
|
||||
?>
|
||||
|
7
website-neu/randomapi.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
$files = glob("images/*/*");
|
||||
$random = rand(0, count($files) - 1);
|
||||
$file = $files[$random];
|
||||
echo "https://jensmemes.tilera.xyz/" . $file;
|
||||
?>
|
||||
|
17
website-neu/script/button.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
const realFileBtn = document.getElementById("real-file");
|
||||
const customBtn = document.getElementById("custom-button");
|
||||
const customTxt = document.getElementById("custom-text");
|
||||
|
||||
customBtn.addEventListener("click", function() {
|
||||
realFileBtn.click();
|
||||
});
|
||||
|
||||
realFileBtn.addEventListener("change", function() {
|
||||
if (realFileBtn.value) {
|
||||
customTxt.innerHTML = realFileBtn.value.match(
|
||||
/[\/\\]([\w\d\s\.\-\(\)]+)$/
|
||||
)[1];
|
||||
} else {
|
||||
customTxt.innerHTML = "No file chosen, yet.";
|
||||
}
|
||||
});
|
36
website-neu/script/modal.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
const openModalButtons = document.querySelectorAll('[data-modal-target]')
|
||||
const closeModalButtons = document.querySelectorAll('[data-close-button]')
|
||||
const overlay = document.getElementById('overlay')
|
||||
|
||||
openModalButtons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const modal = document.querySelector(button.dataset.modalTarget)
|
||||
openModal(modal)
|
||||
})
|
||||
})
|
||||
|
||||
overlay.addEventListener('click', () => {
|
||||
const modals = document.querySelectorAll('.modal.active')
|
||||
modals.forEach(modal => {
|
||||
closeModal(modal)
|
||||
})
|
||||
})
|
||||
|
||||
closeModalButtons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const modal = button.closest('.modal')
|
||||
closeModal(modal)
|
||||
})
|
||||
})
|
||||
|
||||
function openModal(modal) {
|
||||
if (modal == null) return
|
||||
modal.classList.add('active')
|
||||
overlay.classList.add('active')
|
||||
}
|
||||
|
||||
function closeModal(modal) {
|
||||
if (modal == null) return
|
||||
modal.classList.remove('active')
|
||||
overlay.classList.remove('active')
|
||||
}
|
44
website-neu/script/switcher.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
let select = document.getElementById("themeswitcher");
|
||||
let theme = document.getElementById("theme");
|
||||
|
||||
if (checkCookie("theme")) {
|
||||
setTheme(getCookie("theme"));
|
||||
select.value = getCookie("theme");
|
||||
}
|
||||
|
||||
select.addEventListener("change", e => {
|
||||
let selTheme = select.options[select.selectedIndex].value;
|
||||
setTheme(selTheme);
|
||||
setCookie("theme", selTheme, 60);
|
||||
});
|
||||
|
||||
function setTheme(themeName) {
|
||||
theme.href = "/themes/" + themeName + ".css";
|
||||
}
|
||||
|
||||
function getCookie(cname) {
|
||||
var name = cname + "=";
|
||||
var decodedCookie = decodeURIComponent(document.cookie);
|
||||
var ca = decodedCookie.split(";");
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) == " ") {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name) == 0) {
|
||||
return c.substring(name.length, c.length);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function setCookie(cname, cvalue, exdays) {
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
|
||||
var expires = "expires=" + d.toUTCString();
|
||||
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
|
||||
}
|
||||
|
||||
function checkCookie(cookieName) {
|
||||
return getCookie(cookieName) != "";
|
||||
}
|
37
website-neu/style.css
Normal file
|
@ -0,0 +1,37 @@
|
|||
.Bilder_ {
|
||||
padding: 10px;
|
||||
max-width: 300px;
|
||||
max-height:150px;
|
||||
vertical-align: bottom;
|
||||
display: block;
|
||||
margin-top:auto;
|
||||
margin-bottom:auto;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
|
||||
}
|
||||
|
||||
.Videos_ {
|
||||
padding: 10px;
|
||||
max-width: 300px;
|
||||
max-height:150px;
|
||||
margin-top:auto;
|
||||
margin-bottom:auto;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.kasten{
|
||||
background: #555555;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 5px solid grey;
|
||||
float:left;
|
||||
width: 300px;
|
||||
height: 250px;
|
||||
}
|
||||
body{
|
||||
background: #676767;
|
||||
}
|
212
website-neu/themes/dark.css
Normal file
|
@ -0,0 +1,212 @@
|
|||
body{
|
||||
color: #fff;
|
||||
background: #151d28;
|
||||
background-size: cover;
|
||||
font-family: 'Arial';
|
||||
letter-spacing: 0.2px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
select {
|
||||
background: #1a2332;
|
||||
border: solid;
|
||||
border-color: #212a39;
|
||||
color: #b3b3b3;
|
||||
}
|
||||
|
||||
.Bilder_ {
|
||||
padding: 10px;
|
||||
max-width: 300px;
|
||||
max-height:150px;
|
||||
vertical-align: bottom;
|
||||
display: block;
|
||||
margin-top:auto;
|
||||
margin-bottom:auto;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
vertical-align: middle;
|
||||
border: 0 none;
|
||||
max-width: 200px;
|
||||
|
||||
}
|
||||
|
||||
#themediv {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.Videos_ {
|
||||
padding: 10px;
|
||||
max-width: 200px;
|
||||
max-height:150px;
|
||||
margin-top:auto;
|
||||
margin-bottom:auto;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.kasten{
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 5px solid grey;
|
||||
float:left;
|
||||
width: 250px;
|
||||
height: 200px;
|
||||
min-height: 10em;
|
||||
border: 4px solid #1cb09a;
|
||||
}
|
||||
|
||||
.bar-main{
|
||||
background: #1a2332;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
#btn-close-CSS {
|
||||
background: url(/img/head.png)no-repeat;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color:white;
|
||||
background-color: lightgray;
|
||||
border:noe;
|
||||
height:50px;
|
||||
width: 50px;
|
||||
}
|
||||
.img-fixed-info{
|
||||
position: fixed;
|
||||
width: 40px;
|
||||
|
||||
}
|
||||
input[type=text] {
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
color: white;
|
||||
}
|
||||
.btn-logout{
|
||||
background: url(/img/logout.png)no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color:white;
|
||||
background-color: transparent;
|
||||
border:none;
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
padding: 15px;
|
||||
}
|
||||
#custom-button {
|
||||
background-color: #1cb09a;
|
||||
border-radius: 5px;
|
||||
outline: 0;
|
||||
border: 0;
|
||||
color: #FFFFFF;
|
||||
-webkit-transition: all 0.3 ease;
|
||||
transition: all 0.3 ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
#custom-button:hover { /* color of the button, if its hovered */
|
||||
background: #189684;
|
||||
color: #b3b3b3;
|
||||
}
|
||||
|
||||
#custom-text {
|
||||
margin-left: 10px;
|
||||
color: #aaa;
|
||||
}
|
||||
*, *::after, *::before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) scale(0);
|
||||
transition: 200ms ease-in-out;
|
||||
border: 1px solid black;
|
||||
border-radius: 10px;
|
||||
z-index: 10;
|
||||
background-color:#36393f;
|
||||
width: 500px;
|
||||
max-width: 80%;
|
||||
}
|
||||
|
||||
.modal.active {
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 10px 15px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
.modal-header .title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.modal-header .close-button {
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
outline: none;
|
||||
background: none;
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
.close-button{
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
width: 30px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.modal-body {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
#overlay {
|
||||
position: fixed;
|
||||
opacity: 0;
|
||||
transition: 200ms ease-in-out;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color:rgba(50,53,59,0.9);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#overlay.active {
|
||||
opacity: 1;
|
||||
pointer-events: all;
|
||||
}
|
||||
.btn-modal{
|
||||
background: url(/img/info.png)no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color:white;
|
||||
background-color: transparent;
|
||||
border:none;
|
||||
height:40px;
|
||||
width: 50px;
|
||||
padding: 15px;
|
||||
float: left;
|
||||
}
|
||||
a{
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover{
|
||||
font-weight: bold;
|
||||
color:green;
|
||||
}
|
||||
|
||||
#token {
|
||||
outline: 0;
|
||||
box-sizing: border-box;
|
||||
border: solid #212a39;
|
||||
background: #1a2332;
|
||||
}
|
208
website-neu/themes/light.css
Normal file
|
@ -0,0 +1,208 @@
|
|||
:root {
|
||||
--rainbow: #ff0000, #ff7f00, #ffff00, #00ff00, #00ffff, #0000ff, #8b00ff;
|
||||
}
|
||||
|
||||
body {
|
||||
color: #fff;
|
||||
background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
|
||||
url(/img/bg.png);
|
||||
background-repeat: repeat;
|
||||
background-size: 100px;
|
||||
font-family: "Arial";
|
||||
letter-spacing: 0.2px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.Bilder_ {
|
||||
object-fit: contain;
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
display: block;
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.Videos_ {
|
||||
object-fit: contain;
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
display: block;
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.kasten {
|
||||
background: #000000;
|
||||
align-self: stretch;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 5px solid grey;
|
||||
float: left;
|
||||
height: 300px;
|
||||
min-height: 10em;
|
||||
border: 5px solid #cc0000;
|
||||
}
|
||||
|
||||
.bar-main {
|
||||
border: 5px solid #000000;
|
||||
background: linear-gradient(to right, var(--rainbow));
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#btn-close-CSS {
|
||||
background: url(/img/upload.png) no-repeat;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color: white;
|
||||
background-color: lightgray;
|
||||
border: noe;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.img-fixed-info {
|
||||
position: fixed;
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-logout {
|
||||
background: url(/img/logout.png) no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
float: left;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
#custom-button {
|
||||
padding: 5px;
|
||||
color: white;
|
||||
background-color: #009578;
|
||||
border: 1px solid #000;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#custom-button:hover {
|
||||
background-color: #32353b;
|
||||
}
|
||||
|
||||
#custom-text {
|
||||
margin-left: 10px;
|
||||
color: #aaa;
|
||||
}
|
||||
*,
|
||||
*::after,
|
||||
*::before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) scale(0);
|
||||
transition: 200ms ease-in-out;
|
||||
border: 5px solid #cc0000;
|
||||
z-index: 10;
|
||||
background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
|
||||
url(/img/bg.png);
|
||||
background-repeat: repeat;
|
||||
background-size: 100px;
|
||||
width: 500px;
|
||||
max-width: 80%;
|
||||
}
|
||||
|
||||
.modal.active {
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 10px 15px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
.modal-header .title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.modal-header .close-button {
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
outline: none;
|
||||
background: none;
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#themediv {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
width: 30px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
#overlay {
|
||||
position: fixed;
|
||||
opacity: 0;
|
||||
transition: 200ms ease-in-out;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(50, 53, 59, 0.9);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#overlay.active {
|
||||
opacity: 1;
|
||||
pointer-events: all;
|
||||
}
|
||||
.btn-modal {
|
||||
background: url(/img/info.png) no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
float: left;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
margin: 10px;
|
||||
}
|
||||
a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
font-weight: bold;
|
||||
color: green;
|
||||
}
|
207
website-neu/themes/llama.css
Normal file
|
@ -0,0 +1,207 @@
|
|||
body{
|
||||
color: #fff;
|
||||
background: url(/img/bg-img.jpg)no-repeat center center fixed;
|
||||
background-size: cover;
|
||||
font-family: 'Arial';
|
||||
letter-spacing: 0.2px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.Bilder_ {
|
||||
padding: 10px;
|
||||
max-width: 300px;
|
||||
max-height:150px;
|
||||
vertical-align: bottom;
|
||||
display: block;
|
||||
margin-top:auto;
|
||||
margin-bottom:auto;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
vertical-align: middle;
|
||||
border: 0 none;
|
||||
max-width: 200px;
|
||||
|
||||
}
|
||||
|
||||
#themediv {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.Videos_ {
|
||||
padding: 10px;
|
||||
max-width: 200px;
|
||||
max-height:150px;
|
||||
margin-top:auto;
|
||||
margin-bottom:auto;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.kasten{
|
||||
background: rgba(0,0,0,0.6);
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 5px solid grey;
|
||||
float:left;
|
||||
width: 250px;
|
||||
height: 200px;
|
||||
min-height: 10em;
|
||||
border: 4px solid #88f;
|
||||
}
|
||||
|
||||
.bar-main{
|
||||
background: rgba(0,0,0,0.6);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
#btn-close-CSS {
|
||||
background: url(/img/head.png)no-repeat;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color:white;
|
||||
background-color: lightgray;
|
||||
border:noe;
|
||||
height:50px;
|
||||
width: 50px;
|
||||
}
|
||||
.img-fixed-info{
|
||||
position: fixed;
|
||||
width: 40px;
|
||||
|
||||
}
|
||||
input[type=text] {
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
color: white;
|
||||
}
|
||||
.btn-logout{
|
||||
background: url(/img/logout.png)no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color:white;
|
||||
background-color: transparent;
|
||||
border:none;
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
padding: 15px;
|
||||
}
|
||||
#custom-button {
|
||||
padding: 5px;
|
||||
color: white;
|
||||
background-color: #009578;
|
||||
border: 1px solid #000;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#custom-button:hover {
|
||||
background-color: #32353b;
|
||||
}
|
||||
|
||||
#custom-text {
|
||||
margin-left: 10px;
|
||||
color: #aaa;
|
||||
}
|
||||
*, *::after, *::before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) scale(0);
|
||||
transition: 200ms ease-in-out;
|
||||
border: 1px solid black;
|
||||
border-radius: 10px;
|
||||
z-index: 10;
|
||||
background-color:#36393f;
|
||||
width: 500px;
|
||||
max-width: 80%;
|
||||
}
|
||||
|
||||
.modal.active {
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 10px 15px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
.modal-header .title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.modal-header .close-button {
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
outline: none;
|
||||
background: none;
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
.close-button{
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
width: 30px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.modal-body {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
#overlay {
|
||||
position: fixed;
|
||||
opacity: 0;
|
||||
transition: 200ms ease-in-out;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color:rgba(50,53,59,0.9);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#overlay.active {
|
||||
opacity: 1;
|
||||
pointer-events: all;
|
||||
}
|
||||
.btn-modal{
|
||||
background: url(/img/info.png)no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color:white;
|
||||
background-color: transparent;
|
||||
border:none;
|
||||
height:40px;
|
||||
width: 50px;
|
||||
padding: 15px;
|
||||
float: left;
|
||||
}
|
||||
a{
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover{
|
||||
font-weight: bold;
|
||||
color:green;
|
||||
}
|
||||
.btn-home{
|
||||
background: url(/img/home.png)no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
color:white;
|
||||
background-color: transparent;
|
||||
border:none;
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
padding: 15px;
|
||||
}
|
37
website-neu/themes/old.css
Normal file
|
@ -0,0 +1,37 @@
|
|||
.Bilder_ {
|
||||
padding: 10px;
|
||||
max-width: 300px;
|
||||
max-height:150px;
|
||||
vertical-align: bottom;
|
||||
display: block;
|
||||
margin-top:auto;
|
||||
margin-bottom:auto;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
|
||||
}
|
||||
|
||||
.Videos_ {
|
||||
padding: 10px;
|
||||
max-width: 300px;
|
||||
max-height:150px;
|
||||
margin-top:auto;
|
||||
margin-bottom:auto;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.kasten{
|
||||
background: #555555;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 5px solid grey;
|
||||
float:left;
|
||||
width: 300px;
|
||||
height: 250px;
|
||||
}
|
||||
body{
|
||||
background: #676767;
|
||||
}
|