diff --git a/.gitignore b/.gitignore index 7068f6680..2264ab4bd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,9 @@ /.idea /app/config/local.php /app/tmp/cache/* +/app/tmp/templates/* /app/tmp/logs/* /docs/changelog.md /docs/cache/ /docs/*/cache/ +!.gitkeep \ No newline at end of file diff --git a/app/composer.json b/app/composer.json index 4a38a23d8..2cd5635b3 100644 --- a/app/composer.json +++ b/app/composer.json @@ -6,12 +6,11 @@ }, "require": { "php": ">=5.4.0", - "twig/twig": "1.12.*", - "slim/slim": "2.*", - "slim/extras": "2.*", - "slim/views": "0.1.*", + "slim/slim": "^3.9", + "slim/twig-view": "^2.2", "michelf/php-markdown": "1.4.1", - "mnapoli/front-yaml": "~1.2" + "mnapoli/front-yaml": "~1.2", + "monolog/monolog": "^1.23" }, "require-dev": { "phpunit/phpunit": "~4.0" diff --git a/app/composer.lock b/app/composer.lock index 44ffe4200..02877cb2d 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -1,25 +1,59 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "6870489ca88cfd2310ec6abde337b371", + "content-hash": "5108e2bcc1af0fb0e4059906f111e3cb", "packages": [ + { + "name": "container-interop/container-interop", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "shasum": "" + }, + "require": { + "psr/container": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14T19:40:03+00:00" + }, { "name": "erusev/parsedown", - "version": "1.1.2", + "version": "1.6.3", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "9816507a75b27b61035671cd2fc6f524a9b4c25c" + "reference": "728952b90a333b5c6f77f06ea9422b94b585878d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/9816507a75b27b61035671cd2fc6f524a9b4c25c", - "reference": "9816507a75b27b61035671cd2fc6f524a9b4c25c", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/728952b90a333b5c6f77f06ea9422b94b585878d", + "reference": "728952b90a333b5c6f77f06ea9422b94b585878d", "shasum": "" }, + "require": { + "php": ">=5.3.0" + }, "type": "library", "autoload": { "psr-0": { @@ -43,7 +77,7 @@ "markdown", "parser" ], - "time": "2014-11-19 18:18:56" + "time": "2017-05-14T14:47:48+00:00" }, { "name": "michelf/php-markdown", @@ -94,28 +128,29 @@ "keywords": [ "markdown" ], - "time": "2014-05-05 02:43:50" + "time": "2014-05-05T02:43:50+00:00" }, { "name": "mnapoli/front-yaml", - "version": "1.2.0", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/mnapoli/FrontYAML.git", - "reference": "6c99f04051c8cae9e7ce0d45b9a821ffc01a71d2" + "reference": "f10c1dfee1604d15c2b0ab6826eecc1111d65543" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mnapoli/FrontYAML/zipball/6c99f04051c8cae9e7ce0d45b9a821ffc01a71d2", - "reference": "6c99f04051c8cae9e7ce0d45b9a821ffc01a71d2", + "url": "https://api.github.com/repos/mnapoli/FrontYAML/zipball/f10c1dfee1604d15c2b0ab6826eecc1111d65543", + "reference": "f10c1dfee1604d15c2b0ab6826eecc1111d65543", "shasum": "" }, "require": { "erusev/parsedown": "~1.0", - "symfony/yaml": "~2.1" + "symfony/yaml": "~2.1|^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "league/commonmark": "~0.7", + "phpunit/phpunit": "~4.5" }, "type": "library", "autoload": { @@ -127,32 +162,304 @@ "license": [ "MIT" ], - "time": "2014-11-23 22:43:08" + "time": "2016-10-01T11:06:51+00:00" }, { - "name": "slim/extras", - "version": "2.0.3", - "target-dir": "Slim/Extras", + "name": "monolog/monolog", + "version": "1.23.0", "source": { "type": "git", - "url": "https://github.com/codeguy/Slim-Extras.git", - "reference": "a022ed23dae94e164000acd891e3394d903f9623" + "url": "https://github.com/Seldaek/monolog.git", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/codeguy/Slim-Extras/zipball/a022ed23dae94e164000acd891e3394d903f9623", - "reference": "a022ed23dae94e164000acd891e3394d903f9623", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", "shasum": "" }, "require": { "php": ">=5.3.0", - "slim/slim": ">=2.0.0" + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2017-06-19T01:22:40+00:00" + }, + { + "name": "nikic/fast-route", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "b5f95749071c82a8e0f58586987627054400cdf6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/b5f95749071c82a8e0f58586987627054400cdf6", + "reference": "b5f95749071c82a8e0f58586987627054400cdf6", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "FastRoute\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "time": "2017-01-19T11:35:12+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.2.2", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a", + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, "autoload": { "psr-0": { - "Twig_Extensions_": "Views/Extension/", - "Slim\\Extras": "." + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2017-07-23T07:32:15+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -160,50 +467,356 @@ "MIT" ], "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "slim/slim", + "version": "3.9.2", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "4086d0106cf5a7135c69fce4161fe355a8feb118" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/4086d0106cf5a7135c69fce4161fe355a8feb118", + "reference": "4086d0106cf5a7135c69fce4161fe355a8feb118", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.2", + "nikic/fast-route": "^1.0", + "php": ">=5.5.0", + "pimple/pimple": "^3.0", + "psr/container": "^1.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\": "Slim" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" + }, { "name": "Andrew Smith", "email": "a.smith@silentworks.co.uk", - "homepage": "http://thoughts.silentworks.co.uk/" - }, + "homepage": "http://silentworks.co.uk" + } + ], + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "homepage": "https://slimframework.com", + "keywords": [ + "api", + "framework", + "micro", + "router" + ], + "time": "2017-11-26T19:13:09+00:00" + }, + { + "name": "slim/twig-view", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Twig-View.git", + "reference": "f6ff5ec3a24e11866376b8ffa235fbbb7e1d1301" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Twig-View/zipball/f6ff5ec3a24e11866376b8ffa235fbbb7e1d1301", + "reference": "f6ff5ec3a24e11866376b8ffa235fbbb7e1d1301", + "shasum": "" + }, + "require": { + "php": ">=5.5.0", + "psr/http-message": "^1.0", + "twig/twig": "^1.18|^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\Views\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ { "name": "Josh Lockhart", - "email": "info@joshlockhart.com", - "homepage": "http://www.joshlockhart.com/" + "email": "hello@joshlockhart.com", + "homepage": "http://joshlockhart.com" } ], - "description": "Extras package for the Slim Framework", - "homepage": "http://github.com/codeguy/Slim-Extras", + "description": "Slim Framework 3 view helper built on top of the Twig 2 templating component", + "homepage": "http://slimframework.com", "keywords": [ - "extensions", - "middleware", - "templating" + "framework", + "slim", + "template", + "twig", + "view" ], - "time": "2013-01-07 17:56:10" + "time": "2017-09-20T19:47:37+00:00" }, { - "name": "slim/slim", - "version": "2.4.3", + "name": "symfony/polyfill-mbstring", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.3.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46", + "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "require-dev": { + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-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": "2017-10-05T14:43:42+00:00" + }, + { + "name": "twig/twig", + "version": "v2.4.4", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "eddb97148ad779f27e670e1e3f19fb323aedafeb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/eddb97148ad779f27e670e1e3f19fb323aedafeb", + "reference": "eddb97148ad779f27e670e1e3f19fb323aedafeb", + "shasum": "" + }, + "require": { + "php": "^7.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "~2.7", + "symfony/phpunit-bridge": "~3.3@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ], + "time": "2017-09-27T18:10:31+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/codeguy/Slim.git", - "reference": "4906b77a07c7bd6ff1a99aea903e940a2d4fa106" + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/codeguy/Slim/zipball/4906b77a07c7bd6ff1a99aea903e940a2d4fa106", - "reference": "4906b77a07c7bd6ff1a99aea903e940a2d4fa106", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.1" }, - "suggest": { - "ext-mcrypt": "Required for HTTP cookie encryption" + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, "autoload": { - "psr-0": { - "Slim": "." + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", @@ -212,47 +825,50 @@ ], "authors": [ { - "name": "Josh Lockhart", - "email": "info@joshlockhart.com", - "homepage": "http://www.joshlockhart.com/" + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" } ], - "description": "Slim Framework, a PHP micro framework", - "homepage": "http://github.com/codeguy/Slim", + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", "keywords": [ - "microframework", - "rest", - "router" + "constructor", + "instantiate" ], - "time": "2014-04-05 18:33:59" + "time": "2017-07-22T11:58:36+00:00" }, { - "name": "slim/views", - "version": "0.1.2", - "target-dir": "Slim/Views", + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/codeguy/Slim-Views.git", - "reference": "f0a05ea0b654218e40de692ed7cddcad1cf4b828" + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/codeguy/Slim-Views/zipball/f0a05ea0b654218e40de692ed7cddcad1cf4b828", - "reference": "f0a05ea0b654218e40de692ed7cddcad1cf4b828", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { - "php": ">=5.3.0", - "slim/slim": ">=2.4.0" + "php": ">=5.5" }, - "suggest": { - "smarty/smarty": "Smarty templating system", - "twig/twig": "Twig templating system" + "require-dev": { + "phpunit/phpunit": "^4.6" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "psr-0": { - "Slim\\Views": "" + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -261,52 +877,51 @@ ], "authors": [ { - "name": "Andrew Smith", - "email": "a.smith@silentworks.co.uk", - "homepage": "http://www.silentworks.co.uk/" - }, - { - "name": "Josh Lockhart", - "email": "info@joshlockhart.com", - "homepage": "http://www.joshlockhart.com/" + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" } ], - "description": "Smarty and Twig View Parser package for the Slim Framework", - "homepage": "http://github.com/codeguy/Slim-Views", + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", "keywords": [ - "extensions", - "slimphp", - "templating" + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" ], - "time": "2014-04-03 16:31:10" + "time": "2017-09-11T18:02:19+00:00" }, { - "name": "symfony/yaml", - "version": "v2.5.7", - "target-dir": "Symfony/Component/Yaml", + "name": "phpdocumentor/reflection-docblock", + "version": "4.1.1", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "900d38bc8f74a50343ce65dd1c1e9819658ee56b" + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/900d38bc8f74a50343ce65dd1c1e9819658ee56b", - "reference": "900d38bc8f74a50343ce65dd1c1e9819658ee56b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" }, + "type": "library", "autoload": { - "psr-0": { - "Symfony\\Component\\Yaml\\": "" + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -315,102 +930,94 @@ ], "authors": [ { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Mike van Riel", + "email": "me@mikevanriel.com" } ], - "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2014-11-20 13:22:25" + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-08-30T18:51:59+00:00" }, { - "name": "twig/twig", - "version": "v1.12.3", + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", "source": { "type": "git", - "url": "https://github.com/fabpot/Twig.git", - "reference": "27f3428b08c7f656d6824359a9d9dee3f5fce31b" + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/27f3428b08c7f656d6824359a9d9dee3f5fce31b", - "reference": "27f3428b08c7f656d6824359a9d9dee3f5fce31b", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": ">=5.2.4" + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "Twig_": "lib/" + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3" + "MIT" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com" + "name": "Mike van Riel", + "email": "me@mikevanriel.com" } ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ], - "time": "2013-04-08 12:40:11" - } - ], - "packages-dev": [ + "time": "2017-07-14T14:27:02+00:00" + }, { - "name": "doctrine/instantiator", - "version": "1.0.4", + "name": "phpspec/prophecy", + "version": "v1.7.2", "source": { "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" + "url": "https://github.com/phpspec/prophecy.git", + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { "psr-0": { - "Doctrine\\Instantiator\\": "src" + "Prophecy\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -419,31 +1026,39 @@ ], "authors": [ { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" } ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", "keywords": [ - "constructor", - "instantiate" + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" ], - "time": "2014-10-13 12:58:55" + "time": "2017-09-04T11:05:03+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "2.0.11", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "53603b3c995f5aab6b59c8e08c3a663d2cc810b7" + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/53603b3c995f5aab6b59c8e08c3a663d2cc810b7", - "reference": "53603b3c995f5aab6b59c8e08c3a663d2cc810b7", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "shasum": "" }, "require": { @@ -451,12 +1066,12 @@ "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "~1.0", + "sebastian/environment": "^1.3.2", "sebastian/version": "~1.0" }, "require-dev": { "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4.1" + "phpunit/phpunit": "~4" }, "suggest": { "ext-dom": "*", @@ -466,7 +1081,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -475,9 +1090,6 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -495,35 +1107,37 @@ "testing", "xunit" ], - "time": "2014-08-31 06:33:04" + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.3.4", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, "autoload": { "classmap": [ - "File/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -540,20 +1154,20 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { @@ -562,20 +1176,17 @@ "type": "library", "autoload": { "classmap": [ - "Text/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -584,35 +1195,40 @@ "keywords": [ "template" ], - "time": "2014-01-30 17:20:04" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.5", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -628,20 +1244,20 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.3.0", + "version": "1.4.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "f8d5d08c56de5cfd592b3340424a81733259a876" + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/f8d5d08c56de5cfd592b3340424a81733259a876", - "reference": "f8d5d08c56de5cfd592b3340424a81733259a876", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", "shasum": "" }, "require": { @@ -654,7 +1270,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -677,20 +1293,20 @@ "keywords": [ "tokenizer" ], - "time": "2014-08-31 06:12:13" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", - "version": "4.3.5", + "version": "4.8.36", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1" + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2dab9d593997db4abcf58d0daf798eb4e9cecfe1", - "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", "shasum": "" }, "require": { @@ -700,17 +1316,19 @@ "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpunit/php-code-coverage": "~2.0", - "phpunit/php-file-iterator": "~1.3.2", + "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.2", + "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.0", - "sebastian/diff": "~1.1", - "sebastian/environment": "~1.0", - "sebastian/exporter": "~1.0", + "sebastian/comparator": "~1.2.2", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", "sebastian/version": "~1.0", - "symfony/yaml": "~2.0" + "symfony/yaml": "~2.1|~3.0" }, "suggest": { "phpunit/php-invoker": "~1.1" @@ -721,7 +1339,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3.x-dev" + "dev-master": "4.8.x-dev" } }, "autoload": { @@ -730,10 +1348,6 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "", - "../../symfony/yaml/" - ], "license": [ "BSD-3-Clause" ], @@ -745,35 +1359,36 @@ } ], "description": "The PHP Unit Testing framework.", - "homepage": "http://www.phpunit.de/", + "homepage": "https://phpunit.de/", "keywords": [ "phpunit", "testing", "xunit" ], - "time": "2014-11-11 10:11:09" + "time": "2017-06-21T08:07:12+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.0", + "version": "2.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "c63d2367247365f688544f0d500af90a11a44c65" + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65", - "reference": "c63d2367247365f688544f0d500af90a11a44c65", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "shasum": "" }, "require": { - "doctrine/instantiator": "~1.0,>=1.0.1", + "doctrine/instantiator": "^1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.3" + "phpunit/phpunit": "~4.4" }, "suggest": { "ext-soap": "*" @@ -806,34 +1421,34 @@ "mock", "xunit" ], - "time": "2014-10-03 05:12:11" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", - "version": "1.0.1", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", - "sebastian/diff": "~1.1", - "sebastian/exporter": "~1.0" + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { - "phpunit/phpunit": "~4.1" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -870,32 +1485,32 @@ "compare", "equality" ], - "time": "2014-05-11 23:00:21" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.2.0", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -918,36 +1533,36 @@ } ], "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", + "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ "diff" ], - "time": "2014-08-15 10:29:00" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", - "version": "1.2.0", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "0d9bf79554d2a999da194a60416c15cf461eb67d" + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/0d9bf79554d2a999da194a60416c15cf461eb67d", - "reference": "0d9bf79554d2a999da194a60416c15cf461eb67d", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.3" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -972,32 +1587,34 @@ "environment", "hhvm" ], - "time": "2014-10-22 06:38:05" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", - "version": "1.0.2", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0" + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", - "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -1037,20 +1654,124 @@ "export", "exporter" ], - "time": "2014-09-10 00:51:36" + "time": "2016-06-17T09:04:28+00:00" + }, + { + "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-12T03:26:01+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "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": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", - "version": "1.0.3", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43" + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, "type": "library", @@ -1072,13 +1793,64 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2014-03-07 15:35:33" + "time": "2015-06-21T13:59:46+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23T20:04:58+00:00" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, + "prefer-lowest": false, "platform": { "php": ">=5.4.0" }, diff --git a/app/helpers/Cache.php b/app/helpers/Cache.php index 0b27659f4..97be23e92 100644 --- a/app/helpers/Cache.php +++ b/app/helpers/Cache.php @@ -15,17 +15,17 @@ class Cache public static function get($key) { if (!static::isEnabled()) { - return; + return false; } if (empty($key)) { - return; + return false; } $file = static::getPathToCacheFile($key); if (!file_exists($file)) { - return; + return false; } $content = file_get_contents($file); @@ -34,6 +34,7 @@ public static function get($key) return $content; } + return false; } public static function set($key, $content) diff --git a/app/helpers/CacheMiddleware.php b/app/helpers/CacheMiddleware.php index 629f62f78..a65647f21 100644 --- a/app/helpers/CacheMiddleware.php +++ b/app/helpers/CacheMiddleware.php @@ -8,6 +8,9 @@ namespace helpers; +use Slim\Http\Request; +use Slim\Http\Response; + /** * Class CacheMiddleware. * @@ -16,30 +19,32 @@ * * @package helpers */ -class CacheMiddleware extends \Slim\Middleware +class CacheMiddleware { - public function call() - { - /** @var $req \Slim\Http\Request */ - $req = $this->app->request; - /** @var $res \Slim\Http\Response */ - $res = $this->app->response; + public function __invoke(Request $req, Response $res, callable $next) { if ($this->shouldCache($req)) { $content = Cache::get($this->getCacheKey($req)); if (!empty($content)) { - $res->setBody($content); - - return; + if ($this->isJsonData($req)) { + $res = $res->withHeader('Content-Type', 'application/json'); + $res->getBody()->write($content); + } else{ + $res->getBody()->write($content . "\n"); + } + return $res; } } - - $this->next->call(); - - if ($this->shouldCache($req) && 200 == $res->getStatus()) { - Cache::set($this->getCacheKey($req), $res->getBody()); + /** @var Response $res */ + $res = $next($req, $res); + $res->getBody()->rewind(); + $content = $res->getBody()->getContents(); + if ($this->shouldCache($req) && 200 == $res->getStatusCode() && !$this->hadIncludeFileError($content)) { + Cache::set($this->getCacheKey($req), $content); } + + return $res; } /** @@ -48,8 +53,7 @@ public function call() * @param $path * @return mixed|string */ - private function pathToCacheKey($path) - { + private function pathToCacheKey($path) { if ('/' == $path || empty($path)) { return 'index'; } @@ -64,15 +68,26 @@ private function pathToCacheKey($path) return $path; } - private function shouldCache($req) - { + private function shouldCache(Request $req) { return $req->isGet(); } - private function getCacheKey($req) - { + private function hadIncludeFileError($content) { + return (strpos($content, "Error while retrieving") !== false); + } + + private function isJsonData(Request $req) { + return substr($req->getUri()->getPath(), 0, 6) === '/data/'; + } + + private function getCacheKey(Request $req) { $piwikVersion = Environment::getPiwikVersion(); + if ($this->isJsonData($req)) { + $type = "json"; + } else { + $type = "html"; + } - return $piwikVersion . '_' . $this->pathToCacheKey($req->getPath()); + return $piwikVersion . '_' . $this->pathToCacheKey($req->getUri()->getPath()) . "." . $type; } } \ No newline at end of file diff --git a/app/helpers/Log.php b/app/helpers/Log.php deleted file mode 100644 index 31a92308f..000000000 --- a/app/helpers/Log.php +++ /dev/null @@ -1,66 +0,0 @@ -$level($message); - } - } - - private static function getLog() - { - if (!empty(static::$log)) { - return static::$log; - } - - if (Slim::getInstance()) { - - return Slim::getInstance()->getLog(); - } - } -} \ No newline at end of file diff --git a/app/helpers/Markdown/IncludeFilePostprocessor.php b/app/helpers/Markdown/IncludeFilePostprocessor.php index be594dcd9..1162f416c 100644 --- a/app/helpers/Markdown/IncludeFilePostprocessor.php +++ b/app/helpers/Markdown/IncludeFilePostprocessor.php @@ -2,8 +2,6 @@ namespace helpers\Markdown; -use helpers\Log; - /** * Addition to Markdown to allow including remote files. * @@ -68,9 +66,13 @@ private function getFileContent($url, $escape) } try { - $content = mb_convert_encoding(file_get_contents($url), 'HTML-ENTITIES', 'utf-8'); + $response = file_get_contents($url); + if ($response === false) { + throw new \Exception; + } + $content = mb_convert_encoding($response, 'HTML-ENTITIES', 'utf-8'); } catch (\Exception $e) { - Log::error(sprintf("Error while retrieving %s\n%s", $url, $e->getMessage())); +// Log::error(sprintf("Error while retrieving %s\n%s", $url, $e->getMessage())); return 'Error while retrieving ' . htmlentities($url); } diff --git a/app/helpers/PiwikVersionMiddleware.php b/app/helpers/PiwikVersionMiddleware.php index e6c3686cd..1beb20684 100644 --- a/app/helpers/PiwikVersionMiddleware.php +++ b/app/helpers/PiwikVersionMiddleware.php @@ -8,6 +8,9 @@ namespace helpers; +use Slim\Http\Request; +use Slim\Http\Response; + /** * Class CacheMiddleware. * @@ -16,45 +19,39 @@ * * @package helpers */ -class PiwikVersionMiddleware extends \Slim\Middleware +class PiwikVersionMiddleware { - public function call() - { - /** @var $environment \Slim\Environment */ - - $environment = $this->app->environment; - + public function __invoke(Request $req, Response $res, callable $next) { + $uri = $req->getUri(); + $path = $uri->getPath(); // we match eg /2.x or /3.x /19.x and remove it from the path so our routes in routes/page.php still match. // Instead of changing the path I wanted to add a group around all routes in page but slim 2 doesn't allow us to define // a condition on a group route unfortunately $matches = array(); - if ($this->hasPiwikVersionInUrl($environment['PATH_INFO'], $matches)) { + if ($this->hasPiwikVersionInUrl($path, $matches)) { if ($this->isValidPiwikVersionAndAllowedToBeInPath($matches[1])) { // we only allow usage of 2.x or 3.x for outdated Piwik versions. Latest will be always // available only under "/" whereas older versions will be /2.x . Once Piwik 4 is available, // it will automatically work for '/2.x' and '/3.x', we only need to increase LATEST_PIWIK_DOCS_VERSION // in the config Environment::setPiwikVersion($matches[1]); - $environment['PATH_INFO'] = $this->removePiwikVersionFromCurrentPath($environment['PATH_INFO'], $matches[1]); + $uri = $uri->withPath($this->removePiwikVersionFromCurrentPath($path, $matches[1])); + $req = $req->withUri($uri); } } - - $this->next->call(); + return $next($req, $res); } - private function removePiwikVersionFromCurrentPath($path, $piwikVersion) - { + private function removePiwikVersionFromCurrentPath($path, $piwikVersion) { return substr($path, strlen('/' . $piwikVersion . '.x')); } - private function hasPiwikVersionInUrl($path, &$matches) - { + private function hasPiwikVersionInUrl($path, &$matches) { return preg_match('/\/(\d)+\.x(\/)?/', $path, $matches); } - private function isValidPiwikVersionAndAllowedToBeInPath($piwikVersion) - { + private function isValidPiwikVersionAndAllowedToBeInPath($piwikVersion) { return $piwikVersion < LATEST_PIWIK_DOCS_VERSION; } } \ No newline at end of file diff --git a/app/helpers/Url.php b/app/helpers/Url.php new file mode 100644 index 000000000..8ad22feb4 --- /dev/null +++ b/app/helpers/Url.php @@ -0,0 +1,87 @@ +getMenuUrl()); + } catch (DocumentNotExistException $e) { + } + } + } + + if (empty($url)) { + if (strpos($path, '/api-reference/') !== false) { + + try { + $replaced = str_replace('/api-reference/', '', $path); + // we check if the requested resource maybe exists for another Piwik version + $guide = new ApiReferenceGuide($replaced); + $url = Environment::completeUrl($guide->getMenuUrl()); + } catch (DocumentNotExistException $e) { + } + + try { + $replaced = str_replace('/api-reference/', '', $path); + // we check if the requested resource maybe exists for another Piwik version + $phpdoc = new PhpDoc($replaced, $replaced); + $url = Environment::completeUrl($phpdoc->getMenuUrl()); + } catch (DocumentNotExistException $e) { + } + } + } + + if (empty($url)) { + /** @var \helpers\Content\MenuItem[] $categories */ + $categories = [ + new IntegrateCategory(), + new DevelopCategory(), + new DesignCategory(), + new ApiReferenceCategory(), + new DevelopInDepthCategory() + ]; + + foreach ($categories as $category) { + if ($path === $category->getMenuUrl()) { + $url = $path; + break; + } + } + } + + Environment::setPiwikVersion($currentPiwikVersion); + + return $url; + } +} \ No newline at end of file diff --git a/app/public/index.php b/app/public/index.php index 28b2afcdd..e62cac5df 100644 --- a/app/public/index.php +++ b/app/public/index.php @@ -12,43 +12,95 @@ } require '../config/app.php'; -use Slim\Slim; -use Slim\Views\Twig as Twig; -use helpers\Log; -use helpers\CacheMiddleware; -use helpers\PiwikVersionMiddleware; +use helpers\Environment; +use helpers\Git; + +//use helpers\CacheMiddleware; +//use helpers\PiwikVersionMiddleware; +use helpers\Url; +use Monolog\ErrorHandler; date_default_timezone_set("UTC"); -$twig = new Twig(); - -// New Slim App -$app = new Slim(array( - 'view' => $twig, - 'log.enabled' => true, - 'debug' => DEBUG, - 'templates.path' => '../templates', - 'templates.cache' => realpath('../tmp/templates'), - 'templates.charset' => 'utf-8', - 'templates.auto_reload' => true, - 'templates.autoescape' => true, - 'log.writer' => new \Slim\Extras\Log\DateTimeFileWriter( - array('path' => realpath('../tmp/logs'), 'name_format' => 'Y-m-d') - ) -)); -$app->add(new PiwikVersionMiddleware()); -$app->add(new CacheMiddleware()); - -$app->error(function (\Exception $e) use ($app) { - Log::error('An unhandled exception occurred: ' . $e->getMessage() . $e->getTraceAsString()); - - $app->response()->status(500); -}); - -$app->setName('developer.matomo.org'); -$log = $app->getLog(); -$log->setEnabled(true); - -helpers\Twig::registerFilter($app->view->getInstance()); + +$config = [ + 'settings' => [ + 'displayErrorDetails' => DEBUG, + ], +]; + +$app = new \Slim\App($config); + +// Get container +$container = $app->getContainer(); +// Register component on container +$container['view'] = function ($container) { + $view = new \Slim\Views\Twig(realpath("../templates/"), [ + 'cache' => '../tmp/templates', + 'debug' => DEBUG + ]); + + // Instantiate and add Slim specific extension + $basePath = rtrim(str_ireplace('index.php', '', $container['request']->getUri()->getBasePath()), '/'); + $view->addExtension(new Slim\Views\TwigExtension($container['router'], $basePath)); + $view->addExtension(new \Twig_Extension_Debug()); + $twig = $view->getEnvironment(); + helpers\Twig::registerFilter($twig); + + $view->getEnvironment()->addGlobal('urlIfAvailableInNewerVersion', false); + $view->getEnvironment()->addGlobal('availablePiwikVersions', Environment::getAvailablePiwikVersions()); + $view->getEnvironment()->addGlobal('selectedPiwikVersion', Environment::getPiwikVersion()); + $view->getEnvironment()->addGlobal('latestPiwikDocsVersion', LATEST_PIWIK_DOCS_VERSION); + $view->getEnvironment()->addGlobal('revision', Git::getCurrentShortRevision()); +// $view->getEnvironment()->addGlobal('currentPath', $app->request->getPathInfo()); + + return $view; +}; + +$container['logger'] = function ($c) { + $logger = new \Monolog\Logger('site-logger'); + $file_handler = new \Monolog\Handler\StreamHandler('../tmp/logs/app.log', \Monolog\Logger::DEBUG); + $logger->pushHandler($file_handler); + ErrorHandler::register($logger); + return $logger; +}; +$container['errorHandler'] = function ($c) { + return function (Slim\Http\Request $request, Slim\Http\Response $response, Exception $exception) use ($c) { + /** @var \Monolog\Logger $logger */ + $logger = $c->logger; + $logger->addError('An unhandled exception occurred: ' . $exception->getMessage(), [ + "trace" => $exception->getTraceAsString() + ]); + + return $response->withStatus(500) + ->write('Something went wrong!'); + }; +}; + +//Override the default Not Found Handler +$container['notFoundHandler'] = function ($c) { + return function (Slim\Http\Request $request, Slim\Http\Response $response) use ($c) { + /** @var \Monolog\Logger $logger */ + $logger = $c->logger; + $logger->addInfo('Site not found', [ + "path" => (string)$request->getUri() + ]); + + $alternativeUrls = array(); + foreach (Environment::getAvailablePiwikVersions() as $piwikVersion) { + if ($piwikVersion != Environment::getPiwikVersion()) { + $url = Url::getUrlIfDocumentIsAvailableInPiwikVersion($request->getUri()->getPath(), $piwikVersion); + if (!empty($url)) { + $alternativeUrls[] = $url; + } + } + } + return $c->view->render($response->withStatus(404), '404.twig', [ + "alternativeUrls" => $alternativeUrls + ]); + }; +}; +$app->add(new \helpers\CacheMiddleware()); +$app->add(new \helpers\PiwikVersionMiddleware()); require '../routes/page.php'; diff --git a/app/public/js/app.js b/app/public/js/app.js index 27a79aa16..67cd12ef8 100644 --- a/app/public/js/app.js +++ b/app/public/js/app.js @@ -33,7 +33,7 @@ $quickSearchTypeahead.typeahead({ var url = $quickSearchTypeahead.attr('data-action'); $.get(url, {}, function (data) { - quickSearchData = JSON.parse(data); + quickSearchData = data; process(quickSearchData.names); }); } diff --git a/app/routes/page.php b/app/routes/page.php index 83f64825e..e81a04efd 100644 --- a/app/routes/page.php +++ b/app/routes/page.php @@ -7,249 +7,132 @@ */ use helpers\Content\ApiReferenceGuide; +use helpers\Content\Category\ApiReferenceCategory; use helpers\Content\Category\Category; use helpers\Content\Category\CategoryList; use helpers\Content\Category\ChangelogCategory; -use helpers\Content\Category\DesignCategory; use helpers\Content\Category\DevelopCategory; use helpers\Content\Category\DevelopInDepthCategory; -use helpers\Content\Guide; -use helpers\Content\PhpDoc; use helpers\Content\Category\IntegrateCategory; -use helpers\Content\Category\ApiReferenceCategory; -use helpers\Redirects; -use helpers\SearchIndex; use helpers\Content\Category\SupportCategory; +use helpers\Content\Guide; +use helpers\Content\PhpDoc; use helpers\DocumentNotExistException; -use helpers\Git; use helpers\Environment; -use Slim\Slim; - -function send404NotFound(Slim $app) { - $app->pass(); -} - -function initView($app) -{ - $app->hook('slim.before.dispatch', function () use ($app) { - $app->view->setData('urlIfAvailableInNewerVersion', false); - if (!Environment::isLatestPiwikVersion()) { - $app->view->setData('urlIfAvailableInNewerVersion', getUrlIfDocumentIsAvailableInPiwikVersion($app, LATEST_PIWIK_DOCS_VERSION)); - } - - $app->view->setData('availablePiwikVersions', Environment::getAvailablePiwikVersions()); - $app->view->setData('selectedPiwikVersion', Environment::getPiwikVersion()); - $app->view->setData('latestPiwikDocsVersion', LATEST_PIWIK_DOCS_VERSION); - $app->view->setData('revision', Git::getCurrentShortRevision()); - $app->view->setData('currentPath', $app->request->getPathInfo()); - }); -} +use helpers\Redirects; +use helpers\SearchIndex; +use helpers\Url; -function renderGuide(Slim $app, Guide $guide, Category $category) -{ - $app->render('guide.twig', [ +function renderGuide(Slim\Views\Twig $view, Slim\Http\Response $response, Psr\Http\Message\UriInterface $uri, Guide $guide, Category $category) { + return $view->render($response, 'guide.twig', [ 'category' => $category, 'guide' => $guide, 'linkToEditDocument' => $guide->linkToEdit(), 'activeMenu' => $category->getName(), + 'currentPath' => $uri->getPath(), + 'urlIfAvailableInNewerVersion' => (Environment::isLatestPiwikVersion() ? false: Url::getUrlIfDocumentIsAvailableInPiwikVersion($uri->getPath(), LATEST_PIWIK_DOCS_VERSION)) ]); } -initView($app); - -function getUrlIfDocumentIsAvailableInPiwikVersion($app, $piwikVersion) -{ - $currentPiwikVersion = Environment::getPiwikVersion(); - - // we now work in context of that piwik version - Environment::setPiwikVersion($piwikVersion); - - $path = $app->request->getPath(); - $url = ''; - - if ($path === '/' || $path === '') { - $url = '/'; - } - if (empty($url)) { - if (strpos($path, '/guides/') !== false) { - try { - // we check if the requested resource maybe exists for another Piwik version - $guide = new Guide(str_replace('/guides/', '', $path)); - $url = Environment::completeUrl($guide->getMenuUrl()); - } catch (DocumentNotExistException $e) {} - } - } - - if (empty($url)) { - if (strpos($path, '/api-reference/') !== false) { - - try { - $replaced = str_replace('/api-reference/', '', $path); - // we check if the requested resource maybe exists for another Piwik version - $guide = new ApiReferenceGuide( $replaced ); - $url = Environment::completeUrl($guide->getMenuUrl()); - } catch (DocumentNotExistException $e) { - } - - try { - $replaced = str_replace('/api-reference/', '', $path); - // we check if the requested resource maybe exists for another Piwik version - $phpdoc = new PhpDoc($replaced, $replaced); - $url = Environment::completeUrl($phpdoc->getMenuUrl()); - } catch (DocumentNotExistException $e) { - } - } - } - - if (empty($url)) { - /** @var \helpers\Content\MenuItem[] $categories */ - $categories = [ - new IntegrateCategory(), - new DevelopCategory(), - new DesignCategory(), - new ApiReferenceCategory(), - new DevelopInDepthCategory() - ]; - - foreach ($categories as $category) { - if ($path === $category->getMenuUrl() ) { - $url = $path; - break; - } - } - } - - Environment::setPiwikVersion($currentPiwikVersion); - - return $url; -} - -$app->notFound(function () use ($app) { - $alternativeUrls = array(); - foreach (Environment::getAvailablePiwikVersions() as $piwikVersion) { - if ($piwikVersion != Environment::getPiwikVersion()) { - $url = getUrlIfDocumentIsAvailableInPiwikVersion($app, $piwikVersion); - if (!empty($url)) { - $alternativeUrls[] = $url; - } - } - } - $app->view->setData('alternativeUrls', $alternativeUrls); - - $app->render('404.twig'); -}); - // Redirects foreach (Redirects::getRedirects() as $url => $redirect) { - $app->get($url, function () use ($app, $redirect) { - $app->redirect($redirect, 301); + $app->get($url, function (Slim\Http\Request $request, Slim\Http\Response $response, $args) use ($redirect) { + return $response->withStatus(301)->withHeader('Location', $redirect); }); } -$app->get('(/)', function () use ($app) { - $app->render('home.twig', ['isHome' => true]); +$app->get('/', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { + return $this->view->render($response, 'home.twig', ['isHome' => true]); }); -$app->get('/guides/:name1/:name2(/)', function ($name1, $name2) use ($app) { +$app->get('/guides/{name1}/{name2}', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { try { - $guide = new Guide($name1 . '/' . $name2); + $guide = new Guide($args["name1"] . '/' . $args["name2"]); } catch (DocumentNotExistException $e) { - send404NotFound($app); - return; + throw new \Slim\Exception\NotFoundException($request, $response); } $category = CategoryList::getCategory($guide->getCategory()); - renderGuide($app, $guide, $category); + return renderGuide($this->view, $response, $request->getUri(), $guide, $category); }); -$app->get('/guides/:name(/)', function ($name) use ($app) { +$app->get('/guides/{name}', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { try { - $guide = new Guide($name); + $guide = new Guide($args["name"]); } catch (DocumentNotExistException $e) { - send404NotFound($app); - return; + throw new \Slim\Exception\NotFoundException($request, $response); } $category = CategoryList::getCategory($guide->getCategory()); - renderGuide($app, $guide, $category); + return renderGuide($this->view, $response, $request->getUri(), $guide, $category); }); -$app->get('/integration', function () use ($app) { +$app->get('/integration', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { $category = new IntegrateCategory(); - renderGuide($app, $category->getIntroGuide(), $category); -}); - -$app->get('/design', function () use ($app) { - $category = new DesignCategory(); - renderGuide($app, $category->getIntroGuide(), $category); + return renderGuide($this->view, $response, $request->getUri(), $category->getIntroGuide(), $category); }); -$app->get('/develop', function () use ($app) { +$app->get('/develop', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { $category = new DevelopCategory(); - renderGuide($app, $category->getIntroGuide(), $category); + return renderGuide($this->view, $response, $request->getUri(), $category->getIntroGuide(), $category); }); - -$app->get('/piwik-in-depth', function () use ($app) { +$app->get('/piwik-in-depth', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { $category = new DevelopInDepthCategory(); - renderGuide($app, $category->getIntroGuide(), $category); + return renderGuide($this->view, $response, $request->getUri(), $category->getIntroGuide(), $category); }); -$app->get('/api-reference/Piwik/:names+', function ($names) use ($app) { - if (! ctype_alnum(implode('', $names))) { - send404NotFound($app); - return; +$app->get('/api-reference/Piwik/[{params:.*}]', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { + $paramArray = explode("/", $request->getAttribute('params')); + if (!ctype_alnum(implode('', $paramArray))) { + throw new \Slim\Exception\NotFoundException($request, $response); } - $names = array_filter($names); - $file = 'Piwik/' . implode('/', $names); + $file = 'Piwik/' . $request->getAttribute('params'); try { $doc = new PhpDoc($file, $file); } catch (DocumentNotExistException $e) { - send404NotFound($app); - return; + throw new \Slim\Exception\NotFoundException($request, $response); } - - renderGuide($app, $doc, new ApiReferenceCategory()); + return renderGuide($this->view, $response, $request->getUri(), $doc, new ApiReferenceCategory()); }); -$app->get('/api-reference/classes', function () use ($app) { - renderGuide($app, new PhpDoc('Classes', 'classes'), new ApiReferenceCategory()); +$app->get('/api-reference/classes', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { + return renderGuide($this->view, $response, $request->getUri(), new PhpDoc('Classes', 'classes'), new ApiReferenceCategory()); }); -$app->get('/api-reference/events', function () use ($app) { - renderGuide($app, new PhpDoc('Hooks', 'events'), new ApiReferenceCategory()); +$app->get('/api-reference/events', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { + return renderGuide($this->view, $response, $request->getUri(), new PhpDoc('Hooks', 'events'), new ApiReferenceCategory()); }); -$app->get('/api-reference/index', function () use ($app) { - renderGuide($app, new PhpDoc('Index', 'index'), new ApiReferenceCategory()); + +$app->get('/api-reference/index', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { + return renderGuide($this->view, $response, $request->getUri(), new PhpDoc('Index', 'index'), new ApiReferenceCategory()); }); -$app->get('/api-reference/PHP-Piwik-Tracker', function () use ($app) { - renderGuide($app, new PhpDoc('PiwikTracker', 'PHP-Piwik-Tracker'), new ApiReferenceCategory()); + +$app->get('/api-reference/PHP-Piwik-Tracker', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { + return renderGuide($this->view, $response, $request->getUri(), new PhpDoc('PiwikTracker', 'PHP-Piwik-Tracker'), new ApiReferenceCategory()); }); -$app->get('/api-reference/:reference', function ($reference) use ($app) { +$app->get('/api-reference/{reference}', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { try { - $guide = new ApiReferenceGuide($reference); + $guide = new ApiReferenceGuide($args["reference"]); } catch (DocumentNotExistException $e) { - send404NotFound($app); - return; + throw new \Slim\Exception\NotFoundException($request, $response); } - - renderGuide($app, $guide, new ApiReferenceCategory()); - + return renderGuide($this->view, $response, $request->getUri(), $guide, new ApiReferenceCategory()); }); - -$app->get('/api-reference', function () use ($app) { +$app->get('/api-reference', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { $category = new ApiReferenceCategory(); - renderGuide($app, $category->getIntroGuide(), $category); + return renderGuide($this->view, $response, $request->getUri(), $category->getIntroGuide(), $category); }); -$app->get('/support', function () use ($app) { +$app->get('/support', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { $category = new SupportCategory(); - renderGuide($app, $category->getIntroGuide(), $category); + return renderGuide($this->view, $response, $request->getUri(), $category->getIntroGuide(), $category); }); -$app->get('/changelog', function () use ($app) { + +$app->get('/changelog', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { $fetchContent = false; $targetFile = '../../docs/changelog.md'; @@ -265,26 +148,32 @@ function getUrlIfDocumentIsAvailableInPiwikVersion($app, $piwikVersion) if ($fetchContent) { $markdown = file_get_contents('https://raw.githubusercontent.com/piwik/piwik/3.x-dev/CHANGELOG.md'); + if ($markdown === false) { + /** @var \Monolog\Logger $monolog */ + $monolog = $this->logger; + $monolog->error("Could not fetch changelog"); + throw new \Exception("Could not fetch changelog"); + } file_put_contents($targetFile, $markdown); } $category = new ChangelogCategory(); - renderGuide($app, $category->getIntroGuide(), $category); + return renderGuide($this->view, $response, $request->getUri(), $category->getIntroGuide(), $category); }); -$app->get('/data/documents', function () use ($app) { +$app->get('/data/documents', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { $searchIndex = new SearchIndex(); $index = $searchIndex->buildIndex(); - echo json_encode([ + return $response->withJson([ 'urls' => array_keys($index), 'names' => array_values($index) - ], JSON_PRETTY_PRINT); + ]); }); -$app->post('/receive-commit-hook', function () use ($app) { +$app->post('/receive-commit-hook', function (Slim\Http\Request $request, Slim\Http\Response $response, $args) { system('git pull'); \helpers\Cache::invalidate(); echo 'Here is a cookie!'; - exit; + return $request->withHeader('Content-Type', 'text/plain'); });