diff --git a/app/AppKernel.php b/app/AppKernel.php index 9a52f3493..953614c0f 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -25,6 +25,7 @@ class AppKernel extends Kernel new Wallabag\CoreBundle\WallabagCoreBundle(), new Wallabag\ApiBundle\WallabagApiBundle(), new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(), + new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php index b9d62f724..abaf0c179 100644 --- a/app/SymfonyRequirements.php +++ b/app/SymfonyRequirements.php @@ -638,7 +638,7 @@ class SymfonyRequirements extends RequirementCollection } $this->addRecommendation( - class_exists('Locale'), + extension_loaded('intl'), 'intl extension should be available', 'Install and enable the intl extension (used for validators).' ); diff --git a/app/check.php b/app/check.php index 90bad4a71..60ae0a8b3 100644 --- a/app/check.php +++ b/app/check.php @@ -42,9 +42,9 @@ foreach ($symfonyRequirements->getRecommendations() as $req) { } if ($checkPassed) { - echo_block('success', 'OK', 'Your system is ready to run Symfony2 projects', true); + echo_block('success', 'OK', 'Your system is ready to run Symfony2 projects'); } else { - echo_block('error', 'ERROR', 'Your system is not ready to run Symfony2 projects', true); + echo_block('error', 'ERROR', 'Your system is not ready to run Symfony2 projects'); echo_title('Fix the following mandatory requirements', 'red'); diff --git a/app/config/config.yml b/app/config/config.yml index 75e090390..1f5f74410 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -47,7 +47,9 @@ twig: version: %app.version% paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb" flattr_url: "https://flattr.com/thing/1265480" - + form: + resources: + - LexikFormFilterBundle:Form:form_div_layout.html.twig # Assetic Configuration assetic: debug: "%kernel.debug%" diff --git a/composer.json b/composer.json index 5fe6eb022..5c093257e 100644 --- a/composer.json +++ b/composer.json @@ -83,7 +83,8 @@ "wallabag/php-readability": "dev-master", "wallabag/phpMobi": "dev-master", "wallabag/Fivefilters_Libraries": "dev-master", - "pagerfanta/pagerfanta": "~1.0.3" + "pagerfanta/pagerfanta": "~1.0.3", + "lexik/form-filter-bundle": "~4.0" }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "~2.2.0", diff --git a/composer.lock b/composer.lock index a5620bb1e..a99024724 100644 --- a/composer.lock +++ b/composer.lock @@ -1,23 +1,23 @@ { "_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": "d7869b0dce6699d8f4916e675a4209a8", + "hash": "14a5e3837adfc98bca8d7eef22c9cc45", "packages": [ { "name": "doctrine/annotations", - "version": "v1.2.4", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "b5202eb9e83f8db52e0e58867e0a46e63be8332e" + "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/b5202eb9e83f8db52e0e58867e0a46e63be8332e", - "reference": "b5202eb9e83f8db52e0e58867e0a46e63be8332e", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f4a91702ca3cd2e568c3736aa031ed00c3752af4", + "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4", "shasum": "" }, "require": { @@ -72,7 +72,7 @@ "docblock", "parser" ], - "time": "2014-12-23 22:40:37" + "time": "2015-06-17 12:21:22" }, { "name": "doctrine/cache", @@ -585,16 +585,16 @@ }, { "name": "doctrine/instantiator", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { @@ -605,7 +605,7 @@ "ext-pdo": "*", "ext-phar": "*", "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" + "squizlabs/php_codesniffer": "~2.0" }, "type": "library", "extra": { @@ -614,8 +614,8 @@ } }, "autoload": { - "psr-0": { - "Doctrine\\Instantiator\\": "src" + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", @@ -635,7 +635,7 @@ "constructor", "instantiate" ], - "time": "2014-10-13 12:58:55" + "time": "2015-06-14 21:17:01" }, { "name": "doctrine/lexer", @@ -770,16 +770,16 @@ }, { "name": "ezyang/htmlpurifier", - "version": "v4.6.0", + "version": "v4.7.0", "source": { "type": "git", "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd" + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/6f389f0f25b90d0b495308efcfa073981177f0fd", - "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/ae1828d955112356f7677c465f94f7deb7d27a40", + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40", "shasum": "" }, "require": { @@ -810,21 +810,21 @@ "keywords": [ "html" ], - "time": "2013-11-30 08:25:19" + "time": "2015-08-05 01:03:42" }, { "name": "friendsofsymfony/rest-bundle", - "version": "1.6.0", + "version": "1.7.1", "target-dir": "FOS/RestBundle", "source": { "type": "git", "url": "https://github.com/FriendsOfSymfony/FOSRestBundle.git", - "reference": "832d08199cadf1770ec43c2cba68b42b4d5e7f9f" + "reference": "3fb2d30c58cde59213dbddd031bc36171b8b68b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/832d08199cadf1770ec43c2cba68b42b4d5e7f9f", - "reference": "832d08199cadf1770ec43c2cba68b42b4d5e7f9f", + "url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/3fb2d30c58cde59213dbddd031bc36171b8b68b6", + "reference": "3fb2d30c58cde59213dbddd031bc36171b8b68b6", "shasum": "" }, "require": { @@ -863,7 +863,7 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -894,7 +894,7 @@ "keywords": [ "rest" ], - "time": "2015-05-22 20:17:35" + "time": "2015-06-16 08:39:26" }, { "name": "htmlawed/htmlawed", @@ -944,17 +944,16 @@ }, { "name": "incenteev/composer-parameter-handler", - "version": "v2.1.0", - "target-dir": "Incenteev/ParameterHandler", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/Incenteev/ParameterHandler.git", - "reference": "143272a0a09c62616a3c8011fc165a10c6b35241" + "reference": "84a205fe80a46101607bafbc423019527893ddd0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/143272a0a09c62616a3c8011fc165a10c6b35241", - "reference": "143272a0a09c62616a3c8011fc165a10c6b35241", + "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/84a205fe80a46101607bafbc423019527893ddd0", + "reference": "84a205fe80a46101607bafbc423019527893ddd0", "shasum": "" }, "require": { @@ -973,8 +972,8 @@ } }, "autoload": { - "psr-0": { - "Incenteev\\ParameterHandler": "" + "psr-4": { + "Incenteev\\ParameterHandler\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -992,7 +991,7 @@ "keywords": [ "parameters management" ], - "time": "2013-12-07 10:10:39" + "time": "2015-06-03 08:27:03" }, { "name": "jdorn/sql-formatter", @@ -1345,6 +1344,65 @@ ], "time": "2014-12-12 05:04:05" }, + { + "name": "lexik/form-filter-bundle", + "version": "v4.0.0", + "source": { + "type": "git", + "url": "https://github.com/lexik/LexikFormFilterBundle.git", + "reference": "325432453705062ff43b02952b5ca815c5697ba6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lexik/LexikFormFilterBundle/zipball/325432453705062ff43b02952b5ca815c5697ba6", + "reference": "325432453705062ff43b02952b5ca815c5697ba6", + "shasum": "" + }, + "require": { + "doctrine/orm": "~2.2", + "php": ">=5.3.2", + "symfony/form": "~2.7", + "symfony/framework-bundle": "~2.7" + }, + "require-dev": { + "phpunit/phpunit": "~3.7" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "4.x.x-dev" + } + }, + "autoload": { + "psr-4": { + "Lexik\\Bundle\\FormFilterBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dev Lexik", + "email": "dev@lexik.fr" + }, + { + "name": "Cedric Girard", + "email": "c.girard@lexik.fr" + } + ], + "description": "This bundle aim to provide classes to build some form filters and then build a doctrine query from this form filter.", + "homepage": "https://github.com/lexik/LexikFormFilterBundle", + "keywords": [ + "Symfony2", + "bundle", + "doctrine", + "filter", + "form" + ], + "time": "2015-07-31 13:58:10" + }, { "name": "liip/theme-bundle", "version": "1.1.3", @@ -1405,12 +1463,12 @@ "version": "1.5", "source": { "type": "git", - "url": "https://github.com/matstars/simplehtmldom.git", + "url": "https://github.com/matgargano/simplehtmldom.git", "reference": "37fb0d7c1bda45c5a4cf14fdef56c1edf6aa42be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matstars/simplehtmldom/zipball/37fb0d7c1bda45c5a4cf14fdef56c1edf6aa42be", + "url": "https://api.github.com/repos/matgargano/simplehtmldom/zipball/37fb0d7c1bda45c5a4cf14fdef56c1edf6aa42be", "reference": "37fb0d7c1bda45c5a4cf14fdef56c1edf6aa42be", "shasum": "" }, @@ -1500,16 +1558,16 @@ }, { "name": "monolog/monolog", - "version": "1.13.1", + "version": "1.16.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac" + "reference": "c0c0b4bee3aabce7182876b0d912ef2595563db7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", - "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c0c0b4bee3aabce7182876b0d912ef2595563db7", + "reference": "c0c0b4bee3aabce7182876b0d912ef2595563db7", "shasum": "" }, "require": { @@ -1520,12 +1578,14 @@ "psr/log-implementation": "1.0.0" }, "require-dev": { - "aws/aws-sdk-php": "~2.4, >2.4.8", + "aws/aws-sdk-php": "^2.4.9", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", - "phpunit/phpunit": "~4.0", - "raven/raven": "~0.5", - "ruflin/elastica": "0.90.*", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "raven/raven": "~0.8", + "ruflin/elastica": ">=0.90 <3.0", "swiftmailer/swiftmailer": "~5.3", "videlalvaro/php-amqplib": "~2.4" }, @@ -1535,6 +1595,7 @@ "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", + "php-console/php-console": "Allow sending log messages to Google Chrome", "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server", @@ -1543,7 +1604,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13.x-dev" + "dev-master": "1.16.x-dev" } }, "autoload": { @@ -1569,7 +1630,7 @@ "logging", "psr-3" ], - "time": "2015-03-09 09:58:04" + "time": "2015-08-09 17:44:44" }, { "name": "nelmio/api-doc-bundle", @@ -1910,22 +1971,22 @@ }, { "name": "sensio/distribution-bundle", - "version": "v3.0.28", + "version": "v3.0.31", "target-dir": "Sensio/Bundle/DistributionBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", - "reference": "8175618b07793b9d43c3be931f3d8d4c14c9e866" + "reference": "3a900814bd57bf20f9453ae81ff8772bc95d7fff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/8175618b07793b9d43c3be931f3d8d4c14c9e866", - "reference": "8175618b07793b9d43c3be931f3d8d4c14c9e866", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/3a900814bd57bf20f9453ae81ff8772bc95d7fff", + "reference": "3a900814bd57bf20f9453ae81ff8772bc95d7fff", "shasum": "" }, "require": { "php": ">=5.3.3", - "sensiolabs/security-checker": "~2.0", + "sensiolabs/security-checker": "~3.0", "symfony/class-loader": "~2.2", "symfony/framework-bundle": "~2.3", "symfony/process": "~2.2" @@ -1966,20 +2027,20 @@ "configuration", "distribution" ], - "time": "2015-06-01 15:04:20" + "time": "2015-08-03 10:07:12" }, { "name": "sensio/framework-extra-bundle", - "version": "v3.0.8", + "version": "v3.0.10", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "a30fc18bf147bc25faf6b1d54bf55cfad4b63cba" + "reference": "18fc2063c4d6569cdca47a39fbac32342eb65f3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/a30fc18bf147bc25faf6b1d54bf55cfad4b63cba", - "reference": "a30fc18bf147bc25faf6b1d54bf55cfad4b63cba", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/18fc2063c4d6569cdca47a39fbac32342eb65f3c", + "reference": "18fc2063c4d6569cdca47a39fbac32342eb65f3c", "shasum": "" }, "require": { @@ -2021,24 +2082,23 @@ "annotations", "controllers" ], - "time": "2015-05-29 18:27:23" + "time": "2015-08-03 11:59:27" }, { "name": "sensiolabs/security-checker", - "version": "v2.0.5", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/sensiolabs/security-checker.git", - "reference": "2c2a71f1c77d9765c12638c4724d9ca23658a810" + "reference": "7735fd97ff7303d9df776b8dbc970f949399abc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/2c2a71f1c77d9765c12638c4724d9ca23658a810", - "reference": "2c2a71f1c77d9765c12638c4724d9ca23658a810", + "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/7735fd97ff7303d9df776b8dbc970f949399abc9", + "reference": "7735fd97ff7303d9df776b8dbc970f949399abc9", "shasum": "" }, "require": { - "ext-curl": "*", "symfony/console": "~2.0" }, "bin": [ @@ -2047,7 +2107,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2066,7 +2126,7 @@ } ], "description": "A security checker for your composer.lock", - "time": "2015-05-28 14:22:40" + "time": "2015-08-11 12:11:25" }, { "name": "simplepie/simplepie", @@ -2124,23 +2184,23 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v5.4.0", + "version": "v5.4.1", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "31454f258f10329ae7c48763eb898a75c39e0a9f" + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/31454f258f10329ae7c48763eb898a75c39e0a9f", - "reference": "31454f258f10329ae7c48763eb898a75c39e0a9f", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421", + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "mockery/mockery": "~0.9.1" + "mockery/mockery": "~0.9.1,<0.9.4" }, "type": "library", "extra": { @@ -2169,10 +2229,11 @@ "description": "Swiftmailer, free feature-rich PHP mailer", "homepage": "http://swiftmailer.org", "keywords": [ + "email", "mail", "mailer" ], - "time": "2015-03-14 06:06:39" + "time": "2015-06-06 14:19:39" }, { "name": "symfony/assetic-bundle", @@ -2357,16 +2418,16 @@ }, { "name": "symfony/symfony", - "version": "v2.7.0", + "version": "v2.7.3", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "9975b1eca3de4db792a2c3e4e16f676a4aadcd46" + "reference": "a9af4708b4bb650c4897e9b8dfbfbdb2ea5f0486" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/9975b1eca3de4db792a2c3e4e16f676a4aadcd46", - "reference": "9975b1eca3de4db792a2c3e4e16f676a4aadcd46", + "url": "https://api.github.com/repos/symfony/symfony/zipball/a9af4708b4bb650c4897e9b8dfbfbdb2ea5f0486", + "reference": "a9af4708b4bb650c4897e9b8dfbfbdb2ea5f0486", "shasum": "" }, "require": { @@ -2475,20 +2536,20 @@ "keywords": [ "framework" ], - "time": "2015-05-30 16:52:28" + "time": "2015-07-31 13:24:45" }, { "name": "tecnick.com/tcpdf", - "version": "6.2.8", + "version": "6.2.11", "source": { "type": "git", "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "3dee9e7f3a414875fd1d9f4f1dfc2433493a86d2" + "reference": "354433a33946ae7497c3eab291eaaf814bccbfab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/3dee9e7f3a414875fd1d9f4f1dfc2433493a86d2", - "reference": "3dee9e7f3a414875fd1d9f4f1dfc2433493a86d2", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/354433a33946ae7497c3eab291eaaf814bccbfab", + "reference": "354433a33946ae7497c3eab291eaaf814bccbfab", "shasum": "" }, "require": { @@ -2538,7 +2599,7 @@ "pdf417", "qrcode" ], - "time": "2015-04-29 16:13:58" + "time": "2015-08-02 12:30:27" }, { "name": "twig/extensions", @@ -2594,16 +2655,16 @@ }, { "name": "twig/twig", - "version": "v1.18.1", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f" + "reference": "edbeaf43b0a606cdaadc32a11d2673614a377b90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/9f70492f44398e276d1b81c1b43adfe6751c7b7f", - "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/edbeaf43b0a606cdaadc32a11d2673614a377b90", + "reference": "edbeaf43b0a606cdaadc32a11d2673614a377b90", "shasum": "" }, "require": { @@ -2612,7 +2673,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-master": "1.19-dev" } }, "autoload": { @@ -2647,7 +2708,7 @@ "keywords": [ "templating" ], - "time": "2015-04-19 08:30:27" + "time": "2015-07-31 13:45:26" }, { "name": "umpirsky/twig-gettext-extractor", @@ -3143,16 +3204,16 @@ }, { "name": "willdurand/negotiation", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/willdurand/Negotiation.git", - "reference": "d7fa4ce4a0436915b9ba9f7cb5ff37719f0a834c" + "reference": "8a84c5956e765f432542fc52a8c6e9aff4508eb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/willdurand/Negotiation/zipball/d7fa4ce4a0436915b9ba9f7cb5ff37719f0a834c", - "reference": "d7fa4ce4a0436915b9ba9f7cb5ff37719f0a834c", + "url": "https://api.github.com/repos/willdurand/Negotiation/zipball/8a84c5956e765f432542fc52a8c6e9aff4508eb3", + "reference": "8a84c5956e765f432542fc52a8c6e9aff4508eb3", "shasum": "" }, "require": { @@ -3161,12 +3222,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { - "psr-0": { - "Negotiation": "src/" + "psr-4": { + "Negotiation\\": "src/Negotiation" } }, "notification-url": "https://packagist.org/downloads/", @@ -3188,7 +3249,7 @@ "header", "negotiation" ], - "time": "2014-10-02 07:26:00" + "time": "2015-07-28 13:10:50" } ], "packages-dev": [ @@ -3251,17 +3312,16 @@ }, { "name": "doctrine/doctrine-fixtures-bundle", - "version": "v2.2.0", - "target-dir": "Doctrine/Bundle/FixturesBundle", + "version": "v2.2.1", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", - "reference": "c811f96f0cf83b997e3a3ed037cac729bbe3e803" + "reference": "817c2d233fde0fe85cb7e4d25d43fbfcd028aef8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/c811f96f0cf83b997e3a3ed037cac729bbe3e803", - "reference": "c811f96f0cf83b997e3a3ed037cac729bbe3e803", + "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/817c2d233fde0fe85cb7e4d25d43fbfcd028aef8", + "reference": "817c2d233fde0fe85cb7e4d25d43fbfcd028aef8", "shasum": "" }, "require": { @@ -3273,12 +3333,12 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Bundle\\FixturesBundle": "" + "psr-4": { + "Doctrine\\Bundle\\FixturesBundle\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -3286,12 +3346,6 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" @@ -3299,6 +3353,10 @@ { "name": "Doctrine Project", "homepage": "http://www.doctrine-project.org" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony DoctrineFixturesBundle", @@ -3307,7 +3365,7 @@ "Fixture", "persistence" ], - "time": "2013-09-05 11:23:37" + "time": "2015-08-04 22:43:14" }, { "name": "phpdocumentor/reflection-docblock", @@ -3420,16 +3478,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.1.2", + "version": "2.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6b7d2094ca2a685a2cad846cb7cd7a30e8b9470f" + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6b7d2094ca2a685a2cad846cb7cd7a30e8b9470f", - "reference": "6b7d2094ca2a685a2cad846cb7cd7a30e8b9470f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", "shasum": "" }, "require": { @@ -3437,7 +3495,7 @@ "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": { @@ -3452,7 +3510,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -3478,20 +3536,20 @@ "testing", "xunit" ], - "time": "2015-06-01 07:35:26" + "time": "2015-08-04 03:42:39" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", "shasum": "" }, "require": { @@ -3525,20 +3583,20 @@ "filesystem", "iterator" ], - "time": "2015-04-02 05:19:05" + "time": "2015-06-21 13:08:43" }, { "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": { @@ -3547,20 +3605,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" } ], @@ -3569,20 +3624,20 @@ "keywords": [ "template" ], - "time": "2014-01-30 17:20:04" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", - "version": "1.0.5", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" }, "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/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "shasum": "" }, "require": { @@ -3591,13 +3646,10 @@ "type": "library", "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -3613,20 +3665,20 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2015-06-21 08:01:12" }, { "name": "phpunit/php-token-stream", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "eab81d02569310739373308137284e0158424330" + "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330", - "reference": "eab81d02569310739373308137284e0158424330", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9", + "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9", "shasum": "" }, "require": { @@ -3662,20 +3714,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-04-08 04:46:07" + "time": "2015-06-19 03:43:16" }, { "name": "phpunit/phpunit", - "version": "4.6.9", + "version": "4.8.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "816d12536a7a032adc3b68737f82cfbbf98b79c1" + "reference": "fd3050e26e3105f416d74c4d33aea659b406c59d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/816d12536a7a032adc3b68737f82cfbbf98b79c1", - "reference": "816d12536a7a032adc3b68737f82cfbbf98b79c1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fd3050e26e3105f416d74c4d33aea659b406c59d", + "reference": "fd3050e26e3105f416d74c4d33aea659b406c59d", "shasum": "" }, "require": { @@ -3685,15 +3737,15 @@ "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpspec/prophecy": "~1.3,>=1.3.1", - "phpunit/php-code-coverage": "~2.0,>=2.0.11", + "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", + "phpunit/php-timer": ">=1.0.6", "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", - "sebastian/environment": "~1.2", + "sebastian/environment": "~1.3", "sebastian/exporter": "~1.2", "sebastian/global-state": "~1.0", "sebastian/version": "~1.0", @@ -3708,7 +3760,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.6.x-dev" + "dev-master": "4.8.x-dev" } }, "autoload": { @@ -3734,26 +3786,27 @@ "testing", "xunit" ], - "time": "2015-05-29 06:00:03" + "time": "2015-08-10 09:16:56" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.3", + "version": "2.3.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7" + "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/253c005852591fd547fc18cd5b7b43a1ec82d8f7", - "reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42", + "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42", "shasum": "" }, "require": { "doctrine/instantiator": "~1.0,>=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.4" @@ -3789,20 +3842,20 @@ "mock", "xunit" ], - "time": "2015-05-29 05:19:18" + "time": "2015-07-10 06:54:24" }, { "name": "sebastian/comparator", - "version": "1.1.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", "shasum": "" }, "require": { @@ -3816,7 +3869,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -3853,7 +3906,7 @@ "compare", "equality" ], - "time": "2015-01-29 16:28:08" + "time": "2015-07-26 15:48:44" }, { "name": "sebastian/diff", @@ -3909,16 +3962,16 @@ }, { "name": "sebastian/environment", - "version": "1.2.2", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e" + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", "shasum": "" }, "require": { @@ -3955,20 +4008,20 @@ "environment", "hhvm" ], - "time": "2015-01-01 10:01:08" + "time": "2015-08-03 06:14:51" }, { "name": "sebastian/exporter", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "84839970d05254c73cde183a721c7af13aede943" + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", - "reference": "84839970d05254c73cde183a721c7af13aede943", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", "shasum": "" }, "require": { @@ -4021,7 +4074,7 @@ "export", "exporter" ], - "time": "2015-01-27 07:23:06" + "time": "2015-06-21 07:55:53" }, { "name": "sebastian/global-state", @@ -4076,16 +4129,16 @@ }, { "name": "sebastian/recursion-context", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252" + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "shasum": "" }, "require": { @@ -4125,20 +4178,20 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-01-24 09:48:32" + "time": "2015-06-21 08:04:50" }, { "name": "sebastian/version", - "version": "1.0.5", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4" + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", - "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, "type": "library", @@ -4160,7 +4213,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-02-24 06:35:25" + "time": "2015-06-21 13:59:46" }, { "name": "sensio/generator-bundle", diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 29e0ffb0d..8894690ce 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -9,6 +9,9 @@ use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Service\Extractor; use Wallabag\CoreBundle\Form\Type\NewEntryType; use Wallabag\CoreBundle\Form\Type\EditEntryType; +use Wallabag\CoreBundle\Filter\EntryFilterType; +use Pagerfanta\Adapter\DoctrineORMAdapter; +use Pagerfanta\Pagerfanta; class EntryController extends Controller { @@ -89,22 +92,39 @@ class EntryController extends Controller /** * Shows unread entries for current user. * + * @param Request $request + * @param int $page + * * @Route("/unread/list/{page}", name="unread", defaults={"page" = "1"}) * * @return \Symfony\Component\HttpFoundation\Response */ - public function showUnreadAction($page) + public function showUnreadAction(Request $request, $page) { - $entries = $this->getDoctrine() + $form = $this->get('form.factory')->create(new EntryFilterType()); + + $filterBuilder = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') ->findUnreadByUser($this->getUser()->getId()); + if ($request->query->has($form->getName())) { + // manually bind values from the request + $form->submit($request->query->get($form->getName())); + + // build the query from the given form object + $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder); + } + + $pagerAdapter = new DoctrineORMAdapter($filterBuilder->getQuery()); + $entries = new Pagerfanta($pagerAdapter); + $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); $entries->setCurrentPage($page); return $this->render( 'WallabagCoreBundle:Entry:entries.html.twig', array( + 'form' => $form->createView(), 'entries' => $entries, 'currentPage' => $page ) @@ -114,22 +134,39 @@ class EntryController extends Controller /** * Shows read entries for current user. * + * @param Request $request + * @param int $page + * * @Route("/archive/list/{page}", name="archive", defaults={"page" = "1"}) * * @return \Symfony\Component\HttpFoundation\Response */ - public function showArchiveAction($page) + public function showArchiveAction(Request $request, $page) { - $entries = $this->getDoctrine() + $form = $this->get('form.factory')->create(new EntryFilterType()); + + $filterBuilder = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') ->findArchiveByUser($this->getUser()->getId()); + if ($request->query->has($form->getName())) { + // manually bind values from the request + $form->submit($request->query->get($form->getName())); + + // build the query from the given form object + $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder); + } + + $pagerAdapter = new DoctrineORMAdapter($filterBuilder->getQuery()); + $entries = new Pagerfanta($pagerAdapter); + $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); $entries->setCurrentPage($page); return $this->render( 'WallabagCoreBundle:Entry:entries.html.twig', array( + 'form' => $form->createView(), 'entries' => $entries, 'currentPage' => $page ) @@ -139,22 +176,39 @@ class EntryController extends Controller /** * Shows starred entries for current user. * + * @param Request $request + * @param int $page + * * @Route("/starred/list/{page}", name="starred", defaults={"page" = "1"}) * * @return \Symfony\Component\HttpFoundation\Response */ - public function showStarredAction($page) + public function showStarredAction(Request $request, $page) { - $entries = $this->getDoctrine() + $form = $this->get('form.factory')->create(new EntryFilterType()); + + $filterBuilder = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') ->findStarredByUser($this->getUser()->getId()); + if ($request->query->has($form->getName())) { + // manually bind values from the request + $form->submit($request->query->get($form->getName())); + + // build the query from the given form object + $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder); + } + + $pagerAdapter = new DoctrineORMAdapter($filterBuilder->getQuery()); + $entries = new Pagerfanta($pagerAdapter); + $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); $entries->setCurrentPage($page); return $this->render( 'WallabagCoreBundle:Entry:entries.html.twig', array( + 'form' => $form->createView(), 'entries' => $entries, 'currentPage' => $page ) diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php index 8428dce00..0558c53b0 100644 --- a/src/Wallabag/CoreBundle/Controller/RssController.php +++ b/src/Wallabag/CoreBundle/Controller/RssController.php @@ -7,6 +7,8 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Wallabag\CoreBundle\Entity\User; use Wallabag\CoreBundle\Entity\Entry; +use Pagerfanta\Adapter\DoctrineORMAdapter; +use Pagerfanta\Pagerfanta; class RssController extends Controller { @@ -20,12 +22,15 @@ class RssController extends Controller */ public function showUnreadAction(User $user) { - $entries = $this->getDoctrine() + $qb = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') ->findUnreadByUser( $user->getId() ); + $pagerAdapter = new DoctrineORMAdapter($qb->getQuery()); + $entries = new Pagerfanta($pagerAdapter); + $perPage = $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit'); $entries->setMaxPerPage($perPage); @@ -45,12 +50,15 @@ class RssController extends Controller */ public function showArchiveAction(User $user) { - $entries = $this->getDoctrine() + $qb = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') ->findArchiveByUser( $user->getId() ); + $pagerAdapter = new DoctrineORMAdapter($qb->getQuery()); + $entries = new Pagerfanta($pagerAdapter); + $perPage = $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit'); $entries->setMaxPerPage($perPage); @@ -70,12 +78,15 @@ class RssController extends Controller */ public function showStarredAction(User $user) { - $entries = $this->getDoctrine() + $qb = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') ->findStarredByUser( $user->getId() ); + $pagerAdapter = new DoctrineORMAdapter($qb->getQuery()); + $entries = new Pagerfanta($pagerAdapter); + $perPage = $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit'); $entries->setMaxPerPage($perPage); diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index f139bbacc..9aebc55bf 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -7,6 +7,7 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Hateoas\Configuration\Annotation as Hateoas; use JMS\Serializer\Annotation\XmlRoot; +use Wallabag\CoreBundle\Helper\Tools; /** * Entry. @@ -96,7 +97,7 @@ class Entry /** * @var int * - * @ORM\Column(name="reading_type", type="integer", nullable=true) + * @ORM\Column(name="reading_time", type="integer", nullable=true) */ private $readingTime; @@ -264,6 +265,7 @@ class Entry public function setContent($content) { $this->content = $content; + $this->readingTime = Tools::getReadingTime($content); return $this; } diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php new file mode 100644 index 000000000..636ba3246 --- /dev/null +++ b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php @@ -0,0 +1,28 @@ +add('readingTime', 'filter_number_range'); + } + + public function getName() + { + return 'entry_filter'; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'csrf_protection' => false, + 'validation_groups' => array('filtering') + )); + } +} diff --git a/src/Wallabag/CoreBundle/Helper/Tools.php b/src/Wallabag/CoreBundle/Helper/Tools.php index be29ab994..d368ee713 100755 --- a/src/Wallabag/CoreBundle/Helper/Tools.php +++ b/src/Wallabag/CoreBundle/Helper/Tools.php @@ -118,4 +118,16 @@ final class Tools return str_replace('+', '', $token); } + + /** + * For a given text, we calculate reading time for an article. + * + * @param $text + * + * @return float + */ + public static function getReadingTime($text) + { + return floor(str_word_count(strip_tags($text)) / 200); + } } diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index a4514d9e7..f885ee94f 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -13,20 +13,15 @@ class EntryRepository extends EntityRepository * * @param int $userId * - * @return Pagerfanta + * @return QueryBuilder */ public function findUnreadByUser($userId) { - $qb = $this->createQueryBuilder('e') + return $this->createQueryBuilder('e') ->leftJoin('e.user', 'u') ->where('e.isArchived = false') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->orderBy('e.id', 'desc') - ->getQuery(); - - $pagerAdapter = new DoctrineORMAdapter($qb); - - return new Pagerfanta($pagerAdapter); + ->orderBy('e.id', 'desc'); } /** @@ -34,21 +29,15 @@ class EntryRepository extends EntityRepository * * @param int $userId * - * @return Pagerfanta + * @return QueryBuilder */ public function findArchiveByUser($userId) { - $qb = $this->createQueryBuilder('e') - ->select('e') + return $this->createQueryBuilder('e') ->leftJoin('e.user', 'u') ->where('e.isArchived = true') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->orderBy('e.id', 'desc') - ->getQuery(); - - $pagerAdapter = new DoctrineORMAdapter($qb); - - return new Pagerfanta($pagerAdapter); + ->orderBy('e.id', 'desc'); } /** @@ -56,22 +45,15 @@ class EntryRepository extends EntityRepository * * @param int $userId * - * @return Pagerfanta + * @return QueryBuilder */ public function findStarredByUser($userId) { - - $qb = $this->createQueryBuilder('e') - ->select('e') + return $this->createQueryBuilder('e') ->leftJoin('e.user', 'u') ->where('e.isStarred = true') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->orderBy('e.id', 'desc') - ->getQuery(); - - $pagerAdapter = new DoctrineORMAdapter($qb); - - return new Pagerfanta($pagerAdapter); + ->orderBy('e.id', 'desc'); } /** diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig index bf3caf097..7629ef35e 100644 --- a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig @@ -21,11 +21,12 @@ {% if entries is empty %}

{% trans %}No articles found.{% endtrans %}

{% else %} +
{{ form_rest(form) }}
{% for entry in entries %} -
+

{{ entry.title|raw }}

- {% if entry.content| readingTime > 0 %} -
{% trans %}estimated reading time :{% endtrans %} {{ entry.content| readingTime }} min
+ {% if entry.readingTime > 0 %} +
{% trans %}estimated reading time :{% endtrans %} {{ entry.readingTime }} min
{% else %}
{% trans %}estimated reading time :{% endtrans %} < 1 min
{% endif %} diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.xml.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.xml.twig index 5ec9bc037..a39a8dc37 100644 --- a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.xml.twig +++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.xml.twig @@ -17,8 +17,8 @@ {{ entry.createdAt|date('D, d M Y H:i:s') }} 0 -%} - {% trans %}estimated reading time :{% endtrans %} {{ entry.content|readingTime }} min + {%- if entry.readingTime > 0 -%} + {% trans %}estimated reading time :{% endtrans %} {{ entry.readingTime }} min {%- else -%} {% trans %}estimated reading time :{% endtrans %} < 1 min {%- endif %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/_global/public/css/style.css b/src/Wallabag/CoreBundle/Resources/views/themes/_global/public/css/style.css index e3069b866..ffd9d0224 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/_global/public/css/style.css +++ b/src/Wallabag/CoreBundle/Resources/views/themes/_global/public/css/style.css @@ -121,7 +121,7 @@ a:visited { font-size: 1.3em; } -#main #content .entrie { +#main #content .entry { margin-top: 15px; padding-bottom: 15px; border-bottom: 1px dashed #222; @@ -129,19 +129,19 @@ a:visited { } /* First entry */ -#main #content .results + .entrie { +#main #content .results + .entry { clear: both; margin-top: 0; } -#main .entrie .tools { +#main .entry .tools { float: right; text-align: right; list-style-type: none; opacity: 0.5; } -#main .entrie .tools .tool span { +#main .entry .tools .tool span { display: inline-block; width: 16px; height: 16px; diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css index e2844ccc9..6090face6 100755 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css @@ -322,7 +322,7 @@ footer a { letter-spacing:-5px; } -.listmode .entrie { +.listmode .entry { width: 100%!important; margin-left: 0!important; } @@ -343,7 +343,7 @@ footer a { top: -1px; } -.entrie { +.entry { background-color: #FFF; letter-spacing:normal; box-shadow: 0 3px 7px rgba(0,0,0,0.3); @@ -366,7 +366,7 @@ footer a { /* transition: all 0.5s ease; */ } -.entrie:before { +.entry:before { content: ""; width: 0; height: 0; @@ -384,7 +384,7 @@ footer a { transition: all 0.5s ease; } -.entrie:after { +.entry:after { content: ""; position: absolute; height: 7px; @@ -399,34 +399,34 @@ footer a { transition: all 0.5s ease; } -.entrie:hover { +.entry:hover { box-shadow: 0 3px 10px rgba(0,0,0,1); } -.entrie:hover:after { +.entry:hover:after { height: 40px; } -.entrie:hover:before { +.entry:hover:before { bottom: 2.4em; } -.entrie:hover h2 a { +.entry:hover h2 a { color: #666; } -.entrie h2 { +.entry h2 { text-transform: none; margin-bottom: 0; line-height: 1.2; } - .entrie h2:after { + .entry h2:after { content: none; } -.entrie h2 a { +.entry h2 a { display: block; text-decoration: none; color: #000; @@ -438,7 +438,7 @@ footer a { transition: all 0.5s ease; } /* -.entrie h2 a:after { +.entry h2 a:after { content: ""; position: absolute; top: 0; @@ -448,21 +448,21 @@ footer a { } */ -.entrie p { +.entry p { color: #666; font-size: 0.9em; line-height: 1.7; } - .entrie h2 a:first-letter { + .entry h2 a:first-letter { text-transform: uppercase; } -.entrie:hover .tools { +.entry:hover .tools { bottom: 0; } -.entrie .tools { +.entry .tools { position: absolute; bottom: -50px; left: 0; @@ -477,22 +477,22 @@ footer a { transition: all 0.5s ease; } - .entrie .tools a { + .entry .tools a { color: #666; text-decoration: none; display: block; padding: 0.4em; } - .entrie .tools a:hover { + .entry .tools a:hover { color: #FFF; } - .entrie .tools li { + .entry .tools li { display: inline-block; } -.entrie:nth-child(3n+1) { +.entry:nth-child(3n+1) { margin-left: 0; } @@ -941,13 +941,13 @@ pre code { ========================================================================== */ @media screen and (max-width: 1050px) { - .entrie { + .entry { width: 49%; } - .entrie:nth-child(3n+1) { + .entry:nth-child(3n+1) { margin-left: 1.5%; } - .entrie:nth-child(2n+1) { + .entry:nth-child(2n+1) { margin-left: 0; } } @@ -962,7 +962,7 @@ pre code { } @media screen and (max-width: 700px) { - .entrie { + .entry { width: 100%; margin-left: 0; } @@ -972,7 +972,7 @@ pre code { } @media screen and (max-width: 500px) { - .entrie { + .entry { width: 100%; margin-left: 0; } diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index fbdc1ffdf..b9f1be495 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig @@ -18,6 +18,7 @@ {% if entries is not empty %}
{{ entries.count }} {% trans %}entries{% endtrans %}
+
{{ form_rest(form) }}
    {% for p in range(1, entries.nbPages) %}
  • @@ -38,8 +39,8 @@
    {{ entry.title|raw }} - {% if entry.content| readingTime > 0 %} -
    {% trans %}estimated reading time: {% endtrans %} {{ entry.content| readingTime }} min
    + {% if entry.readingTime > 0 %} +
    {% trans %}estimated reading time: {% endtrans %} {{ entry.readingTime }} min
    {% else %}
    {% trans %}estimated reading time: {% endtrans %} < 1 min
    {% endif %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/css/print.css b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/css/print.css index 9dd6d295c..2a799c44d 100755 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/css/print.css +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/css/print.css @@ -25,7 +25,7 @@ body > footer, div.tools, header div, .messages, -.entrie + .results { +.entry + .results { display: none !important; } diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 2cd501306..24848eb2f 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php @@ -240,4 +240,23 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertEquals(403, $client->getResponse()->getStatusCode()); } + + public function testFilterOnUnreadeView() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/unread/list'); + + $form = $crawler->filter('button[id=submit-filter]')->form(); + + $data = array( + 'entry_filter[readingTime][right_number]' => 11, + 'entry_filter[readingTime][left_number]' => 11 + ); + + $crawler = $client->submit($form, $data); + + $this->assertCount(1, $crawler->filter('div[class=entry]')); + } } diff --git a/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php index 18388948e..5f0a96434 100644 --- a/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php +++ b/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php @@ -7,7 +7,6 @@ class WallabagExtension extends \Twig_Extension public function getFilters() { return array( - new \Twig_SimpleFilter('readingTime', array($this, 'getReadingTime')), new \Twig_SimpleFilter('domainName', array($this, 'getDomainName')), ); } @@ -24,18 +23,6 @@ class WallabagExtension extends \Twig_Extension return parse_url($url, PHP_URL_HOST); } - /** - * For a given text, we calculate reading time for an article. - * - * @param $text - * - * @return float - */ - public static function getReadingTime($text) - { - return floor(str_word_count(strip_tags($text)) / 200); - } - public function getName() { return 'wallabag_extension';