Merge branch '2.7'
* 2.7: (26 commits) Updated generateSql tool Fix grammar Fix the implementation of deprecated Locale classes Fix phpdoc and coding standards Replace usages of the deprecated TypeTestCase by the new one Remove usages of deprecated constants Update functional tests to use the PSR NullLogger Updated the SQL data generated from the generateSql tool Updated generateSql tool fix regression in form tests after pr #13027 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - [FrameworkBundle] added a test router for the buil-in web server Make fabbot happy Clean up testing No global state for isolated tests and other fixes No global state for isolated tests and other fixes fix #10054 - form data collector with dynamic fields [TwigBundle] Moved the setting of the default escaping strategy from the Twig engine to the Twig environment [Debug] fix checkip6 [HttpFoundation] fixed error when an IP in the X-Forwarded-For HTTP header contains a port [2.7] Allow 3.0 requirements ...
This commit is contained in:
commit
86354c7352
|
@ -38,7 +38,7 @@ install:
|
|||
- if [ "$components" = "no" ]; then COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install; fi;
|
||||
|
||||
script:
|
||||
- if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo "Running {} tests"; phpunit --exclude-group tty,benchmark,intl-data {};'; fi;
|
||||
- if [ "$components" = "no" ]; then echo "Running tests requiring tty"; phpunit --group tty; fi;
|
||||
- if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order 'echo "Running {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install; phpunit --exclude-group tty,benchmark,intl-data;'; fi;
|
||||
- if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j50% 'echo "Running {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data;'; fi;
|
||||
- if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||
- if [ "$components" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
|
||||
- if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||
- if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
||||
|
|
|
@ -394,7 +394,7 @@ With `LoggingTranslator`, a new translator class is introduced with Symfony
|
|||
2.6. By default, the `@translator` service is referring to this class in the
|
||||
debug environment.
|
||||
|
||||
If you have own services that depend on the `@translator` service and expect
|
||||
If you have your own services that depend on the `@translator` service and expect
|
||||
this service to be an instance of either
|
||||
`Symfony\Component\Translation\Translator` or
|
||||
`Symfony\Bundle\FrameworkBundle\Translation\Translator`, e.g. by type-hinting
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"doctrine/common": "~2.2",
|
||||
"twig/twig": "~1.12",
|
||||
"doctrine/common": "~2.3",
|
||||
"twig/twig": "~1.12,>=1.12.3",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"replace": {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
namespace Symfony\Bridge\Doctrine;
|
||||
|
||||
use Doctrine\Common\Persistence\ManagerRegistry as ManagerRegistryInterface;
|
||||
use Doctrine\ORM\Configuration;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\DependencyInjection\Definition;
|
|||
class RegisterEventListenersAndSubscribersPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testExceptionOnAbstractTaggedSubscriber()
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ class RegisterEventListenersAndSubscribersPassTest extends \PHPUnit_Framework_Te
|
|||
}
|
||||
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testExceptionOnAbstractTaggedListener()
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Symfony\Bridge\Doctrine\Tests\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\Tests\FormPerformanceTestCase;
|
||||
use Symfony\Component\Form\Test\FormPerformanceTestCase;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Symfony\Bridge\Doctrine\Tests\DoctrineOrmTestCase;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
namespace Symfony\Bridge\Doctrine\Tests\Form\Type;
|
||||
|
||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Form\Test\TypeTestCase;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\GroupableEntity;
|
||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
"doctrine/common": "~2.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/stopwatch": "~2.2",
|
||||
"symfony/dependency-injection": "~2.2",
|
||||
"symfony/form": "~2.3,>=2.3.8",
|
||||
"symfony/http-kernel": "~2.2",
|
||||
"symfony/property-access": "~2.3",
|
||||
"symfony/security": "~2.2",
|
||||
"symfony/expression-language": "~2.2",
|
||||
"symfony/validator": "~2.5,>=2.5.5",
|
||||
"symfony/translation": "~2.0,>=2.0.5",
|
||||
"symfony/stopwatch": "~2.2|~3.0.0",
|
||||
"symfony/dependency-injection": "~2.2|~3.0.0",
|
||||
"symfony/form": "~2.3,>=2.3.8|~3.0.0",
|
||||
"symfony/http-kernel": "~2.2|~3.0.0",
|
||||
"symfony/property-access": "~2.3|~3.0.0",
|
||||
"symfony/security": "~2.2|~3.0.0",
|
||||
"symfony/expression-language": "~2.2|~3.0.0",
|
||||
"symfony/validator": "~2.5,>=2.5.5|~3.0.0",
|
||||
"symfony/translation": "~2.0,>=2.0.5|~3.0.0",
|
||||
"doctrine/data-fixtures": "1.0.*",
|
||||
"doctrine/dbal": "~2.2",
|
||||
"doctrine/orm": "~2.2,>=2.2.3"
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
"monolog/monolog": "~1.11"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/http-kernel": "~2.4",
|
||||
"symfony/console": "~2.4",
|
||||
"symfony/event-dispatcher": "~2.2"
|
||||
"symfony/http-kernel": "~2.4|~3.0.0",
|
||||
"symfony/console": "~2.4|~3.0.0",
|
||||
"symfony/event-dispatcher": "~2.2|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.",
|
||||
"symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.",
|
||||
"symfony/event-dispatcher": "Needed when using log messages in console commands"
|
||||
"symfony/event-dispatcher": "Needed when using log messages in console commands."
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Symfony\\Bridge\\Monolog\\": "" }
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/http-foundation": "~2.0,>=2.0.5",
|
||||
"symfony/http-kernel": "~2.0,>=2.0.5",
|
||||
"symfony/form": "~2.3,>=2.3.8",
|
||||
"symfony/property-access": "~2.3",
|
||||
"symfony/http-foundation": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/http-kernel": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/form": "~2.3,>=2.3.8|~3.0.0",
|
||||
"symfony/property-access": "~2.3|~3.0.0",
|
||||
"propel/propel1": "~1.6,>=1.6.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/stopwatch": "~2.2"
|
||||
"symfony/stopwatch": "~2.2|~3.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Symfony\\Bridge\\Propel1\\": "" }
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
|
||||
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\Instantiator;
|
||||
|
||||
use ProxyManager\Proxy\LazyLoadingInterface;
|
||||
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/dependency-injection": "~2.3",
|
||||
"symfony/dependency-injection": "~2.3|~3.0.0",
|
||||
"ocramius/proxy-manager": "~0.4|~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.3"
|
||||
"symfony/config": "~2.3|~3.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
|
|
|
@ -23,6 +23,7 @@ class FormEnctypeNode extends SearchAndRenderBlockNode
|
|||
{
|
||||
parent::compile($compiler);
|
||||
|
||||
$compiler->write('trigger_error(\'The helper form_enctype(form) is deprecated since version 2.3 and will be removed in 3.0. Use form_start(form) instead.\', E_USER_DEPRECATED)');
|
||||
// Uncomment this as soon as the deprecation note should be shown
|
||||
// $compiler->write('trigger_error(\'The helper form_enctype(form) is deprecated since version 2.3 and will be removed in 3.0. Use form_start(form) instead.\', E_USER_DEPRECATED)');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,23 +17,23 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/security-csrf": "~2.4",
|
||||
"symfony/security-csrf": "~2.4|~3.0.0",
|
||||
"twig/twig": "~1.13,>=1.13.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/finder": "~2.3",
|
||||
"symfony/form": "~2.6",
|
||||
"symfony/http-kernel": "~2.3",
|
||||
"symfony/locale": "~2.0,>=2.0.5",
|
||||
"symfony/routing": "~2.2",
|
||||
"symfony/templating": "~2.1",
|
||||
"symfony/translation": "~2.2",
|
||||
"symfony/yaml": "~2.0,>=2.0.5",
|
||||
"symfony/security": "~2.4",
|
||||
"symfony/stopwatch": "~2.2",
|
||||
"symfony/console": "~2.4",
|
||||
"symfony/var-dumper": "~2.6",
|
||||
"symfony/expression-language": "~2.4"
|
||||
"symfony/finder": "~2.3|~3.0.0",
|
||||
"symfony/form": "~2.6|~3.0.0",
|
||||
"symfony/http-kernel": "~2.3|~3.0.0",
|
||||
"symfony/locale": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/routing": "~2.2|~3.0.0",
|
||||
"symfony/templating": "~2.1|~3.0.0",
|
||||
"symfony/translation": "~2.2|~3.0.0",
|
||||
"symfony/yaml": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/security": "~2.4|~3.0.0",
|
||||
"symfony/stopwatch": "~2.2|~3.0.0",
|
||||
"symfony/console": "~2.4|~3.0.0",
|
||||
"symfony/var-dumper": "~2.6|~3.0.0",
|
||||
"symfony/expression-language": "~2.4|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/finder": "",
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/http-kernel": "~2.6",
|
||||
"symfony/twig-bridge": "~2.6",
|
||||
"symfony/var-dumper": "~2.6"
|
||||
"symfony/http-kernel": "~2.6|~3.0.0",
|
||||
"symfony/twig-bridge": "~2.6|~3.0.0",
|
||||
"symfony/var-dumper": "~2.6|~3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.3",
|
||||
"symfony/dependency-injection": "~2.3"
|
||||
"symfony/config": "~2.3|~3.0.0",
|
||||
"symfony/dependency-injection": "~2.3|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/config": "For service container configuration",
|
||||
|
|
|
@ -68,8 +68,8 @@ router script using <info>--router</info> option:
|
|||
|
||||
<info>%command.full_name% --router=app/config/router.php</info>
|
||||
|
||||
Specifing a router script is required when the used environment is not "dev" or
|
||||
"prod".
|
||||
Specifing a router script is required when the used environment is not "dev",
|
||||
"prod", or "test".
|
||||
|
||||
See also: http://www.php.net/manual/en/features.commandline.webserver.php
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file implements rewrite rules for PHP built-in web server.
|
||||
*
|
||||
* See: http://www.php.net/manual/en/features.commandline.webserver.php
|
||||
*
|
||||
* If you have custom directory layout, then you have to write your own router
|
||||
* and pass it as a value to 'router' option of server:run command.
|
||||
*
|
||||
* @author: Michał Pipa <michal.pipa.xsolve@gmail.com>
|
||||
* @author: Albert Jessurum <ajessu@gmail.com>
|
||||
*/
|
||||
|
||||
if (is_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$_SERVER = array_merge($_SERVER, $_ENV);
|
||||
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app_test.php';
|
||||
|
||||
require 'app_test.php';
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass;
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FragmentRendererPass;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass;
|
||||
|
||||
|
|
|
@ -11,4 +11,4 @@ framework:
|
|||
storage_id: session.storage.mock_file
|
||||
|
||||
services:
|
||||
logger: { class: Symfony\Component\HttpKernel\Log\NullLogger }
|
||||
logger: { class: Psr\Log\NullLogger }
|
||||
|
|
|
@ -40,7 +40,7 @@ class TimedPhpEngineTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\DependencyInjection\Container
|
||||
* @return Container
|
||||
*/
|
||||
private function getContainer()
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ class TimedPhpEngineTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables
|
||||
* @return GlobalVariables
|
||||
*/
|
||||
private function getGlobalVariables()
|
||||
{
|
||||
|
|
|
@ -19,32 +19,32 @@
|
|||
"php": ">=5.3.3",
|
||||
"symfony/dependency-injection" : "~2.6,>=2.6.2",
|
||||
"symfony/config" : "~2.4",
|
||||
"symfony/event-dispatcher": "~2.5",
|
||||
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4",
|
||||
"symfony/http-kernel": "~2.6",
|
||||
"symfony/filesystem": "~2.3",
|
||||
"symfony/routing": "~2.2",
|
||||
"symfony/security-core": "~2.6",
|
||||
"symfony/security-csrf": "~2.6",
|
||||
"symfony/stopwatch": "~2.3",
|
||||
"symfony/templating": "~2.1",
|
||||
"symfony/translation": "~2.6",
|
||||
"symfony/event-dispatcher": "~2.5|~3.0.0",
|
||||
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4|~3.0.0",
|
||||
"symfony/http-kernel": "~2.6|~3.0.0",
|
||||
"symfony/filesystem": "~2.3|~3.0.0",
|
||||
"symfony/routing": "~2.2|~3.0.0",
|
||||
"symfony/security-core": "~2.6|~3.0.0",
|
||||
"symfony/security-csrf": "~2.6|~3.0.0",
|
||||
"symfony/stopwatch": "~2.3|~3.0.0",
|
||||
"symfony/templating": "~2.1|~3.0.0",
|
||||
"symfony/translation": "~2.6|~3.0.0",
|
||||
"doctrine/annotations": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/browser-kit": "~2.4",
|
||||
"symfony/console": "~2.4,>=2.4.8",
|
||||
"symfony/css-selector": "~2.0,>=2.0.5",
|
||||
"symfony/dom-crawler": "~2.0,>=2.0.5",
|
||||
"symfony/finder": "~2.0,>=2.0.5",
|
||||
"symfony/locale": "~2.0,>=2.0.5",
|
||||
"symfony/security": "~2.6",
|
||||
"symfony/form": "~2.6",
|
||||
"symfony/class-loader": "~2.1",
|
||||
"symfony/expression-language": "~2.6",
|
||||
"symfony/process": "~2.0,>=2.0.5",
|
||||
"symfony/validator": "~2.5",
|
||||
"symfony/yaml": "~2.0,>=2.0.5"
|
||||
"symfony/browser-kit": "~2.4|~3.0.0",
|
||||
"symfony/console": "~2.4,>=2.4.8|~3.0.0",
|
||||
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/finder": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/locale": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/security": "~2.6|~3.0.0",
|
||||
"symfony/form": "~2.6|~3.0.0",
|
||||
"symfony/class-loader": "~2.1|~3.0.0",
|
||||
"symfony/expression-language": "~2.6|~3.0.0",
|
||||
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/validator": "~2.5|~3.0.0",
|
||||
"symfony/yaml": "~2.0,>=2.0.5|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/console": "For using the console commands",
|
||||
|
|
|
@ -12,7 +12,7 @@ framework:
|
|||
profiler: { only_exceptions: false }
|
||||
|
||||
services:
|
||||
logger: { class: Symfony\Component\HttpKernel\Log\NullLogger }
|
||||
logger: { class: Psr\Log\NullLogger }
|
||||
|
||||
security:
|
||||
firewalls:
|
||||
|
|
|
@ -12,4 +12,4 @@ framework:
|
|||
profiler: { only_exceptions: false }
|
||||
|
||||
services:
|
||||
logger: { class: Symfony\Component\HttpKernel\Log\NullLogger }
|
||||
logger: { class: Psr\Log\NullLogger }
|
||||
|
|
|
@ -17,24 +17,24 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/security": "~2.6",
|
||||
"symfony/http-kernel": "~2.2"
|
||||
"symfony/security": "~2.6|~3.0.0",
|
||||
"symfony/http-kernel": "~2.2|~3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/browser-kit": "~2.4",
|
||||
"symfony/console": "~2.3",
|
||||
"symfony/css-selector": "~2.0,>=2.0.5",
|
||||
"symfony/dependency-injection": "~2.3",
|
||||
"symfony/dom-crawler": "~2.0,>=2.0.5",
|
||||
"symfony/form": "~2.4",
|
||||
"symfony/framework-bundle": "~2.6",
|
||||
"symfony/http-foundation": "~2.3",
|
||||
"symfony/twig-bundle": "~2.2",
|
||||
"symfony/twig-bridge": "~2.2,>=2.2.6",
|
||||
"symfony/process": "~2.0,>=2.0.5",
|
||||
"symfony/validator": "~2.5",
|
||||
"symfony/yaml": "~2.0,>=2.0.5",
|
||||
"symfony/expression-language": "~2.6",
|
||||
"symfony/browser-kit": "~2.4|~3.0.0",
|
||||
"symfony/console": "~2.3|~3.0.0",
|
||||
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/dependency-injection": "~2.3|~3.0.0",
|
||||
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/form": "~2.4|~3.0.0",
|
||||
"symfony/framework-bundle": "~2.6|~3.0.0",
|
||||
"symfony/http-foundation": "~2.3|~3.0.0",
|
||||
"symfony/twig-bundle": "~2.2|~3.0.0",
|
||||
"symfony/twig-bridge": "~2.2,>=2.2.6|~3.0.0",
|
||||
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/validator": "~2.5|~3.0.0",
|
||||
"symfony/yaml": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/expression-language": "~2.6|~3.0.0",
|
||||
"doctrine/doctrine-bundle": "~1.2",
|
||||
"twig/twig": "~1.12"
|
||||
},
|
||||
|
|
|
@ -156,7 +156,9 @@ class Configuration implements ConfigurationInterface
|
|||
$rootNode
|
||||
->fixXmlConfig('path')
|
||||
->children()
|
||||
->scalarNode('autoescape')->end()
|
||||
->variableNode('autoescape')
|
||||
->defaultValue(array('Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy', 'guess'))
|
||||
->end()
|
||||
->scalarNode('autoescape_service')->defaultNull()->end()
|
||||
->scalarNode('autoescape_service_method')->defaultNull()->end()
|
||||
->scalarNode('base_template_class')->example('Twig_Template')->end()
|
||||
|
|
|
@ -109,12 +109,9 @@ class TwigExtension extends Extension
|
|||
}
|
||||
|
||||
if (isset($config['autoescape_service']) && isset($config['autoescape_service_method'])) {
|
||||
$container->findDefinition('templating.engine.twig')->addMethodCall('setDefaultEscapingStrategy', array(array(new Reference($config['autoescape_service']), $config['autoescape_service_method'])));
|
||||
|
||||
unset($config['autoescape_service'], $config['autoescape_service_method']);
|
||||
} elseif (!isset($config['autoescape'])) {
|
||||
$container->findDefinition('templating.engine.twig')->addMethodCall('setDefaultEscapingStrategy', array(array(new Reference('templating.engine.twig'), 'guessDefaultEscapingStrategy')));
|
||||
$config['autoescape'] = array(new Reference($config['autoescape_service']), $config['autoescape_service_method']);
|
||||
}
|
||||
unset($config['autoescape_service'], $config['autoescape_service_method']);
|
||||
|
||||
$container->setParameter('twig.options', $config);
|
||||
|
||||
|
|
|
@ -11,12 +11,24 @@
|
|||
|
||||
namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass;
|
||||
|
||||
class TwigLoaderPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var \PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $builder;
|
||||
/**
|
||||
* @var Definition
|
||||
*/
|
||||
private $chainLoader;
|
||||
/**
|
||||
* @var TwigLoaderPass
|
||||
*/
|
||||
private $pass;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->builder = $this->getMock(
|
||||
|
|
|
@ -98,7 +98,8 @@ class TwigExtensionTest extends TestCase
|
|||
$this->loadFromFile($container, 'customTemplateEscapingGuesser', $format);
|
||||
$this->compileContainer($container);
|
||||
|
||||
$this->assertTemplateEscapingGuesserDefinition($container, 'my_project.some_bundle.template_escaping_guesser', 'guess');
|
||||
$options = $container->getParameter('twig.options');
|
||||
$this->assertEquals(array(new Reference('my_project.some_bundle.template_escaping_guesser'), 'guess'), $options['autoescape']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,7 +112,8 @@ class TwigExtensionTest extends TestCase
|
|||
$this->loadFromFile($container, 'empty', $format);
|
||||
$this->compileContainer($container);
|
||||
|
||||
$this->assertTemplateEscapingGuesserDefinition($container, 'templating.engine.twig', 'guessDefaultEscapingStrategy');
|
||||
$options = $container->getParameter('twig.options');
|
||||
$this->assertEquals(array('Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy', 'guess'), $options['autoescape']);
|
||||
}
|
||||
|
||||
public function testGlobalsWithDifferentTypesAndValues()
|
||||
|
@ -253,18 +255,4 @@ class TwigExtensionTest extends TestCase
|
|||
|
||||
$loader->load($file.'.'.$format);
|
||||
}
|
||||
|
||||
private function assertTemplateEscapingGuesserDefinition(ContainerBuilder $container, $serviceId, $serviceMethod)
|
||||
{
|
||||
$def = $container->getDefinition('templating.engine.twig');
|
||||
|
||||
$this->assertCount(1, $def->getMethodCalls());
|
||||
|
||||
foreach ($def->getMethodCalls() as $call) {
|
||||
if ('setDefaultEscapingStrategy' === $call[0]) {
|
||||
$this->assertSame($serviceId, (string) $call[1][0][0]);
|
||||
$this->assertSame($serviceMethod, $call[1][0][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\TwigBundle;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class TwigDefaultEscapingStrategy
|
||||
{
|
||||
public static function guess($filename)
|
||||
{
|
||||
// remove .twig
|
||||
$filename = substr($filename, 0, -5);
|
||||
|
||||
// get the format
|
||||
$format = substr($filename, strrpos($filename, '.') + 1);
|
||||
|
||||
if ('js' === $format) {
|
||||
return 'js';
|
||||
}
|
||||
|
||||
if ('txt' === $format) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 'html';
|
||||
}
|
||||
}
|
|
@ -41,28 +41,21 @@ class TwigEngine extends BaseEngine implements EngineInterface
|
|||
$this->locator = $locator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Inject the escaping
|
||||
* strategy on Twig_Environment instead
|
||||
*/
|
||||
public function setDefaultEscapingStrategy($strategy)
|
||||
{
|
||||
$this->environment->getExtension('escaper')->setDefaultStrategy($strategy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Use TwigDefaultEscapingStrategy instead.
|
||||
*/
|
||||
public function guessDefaultEscapingStrategy($filename)
|
||||
{
|
||||
// remove .twig
|
||||
$filename = substr($filename, 0, -5);
|
||||
|
||||
// get the format
|
||||
$format = substr($filename, strrpos($filename, '.') + 1);
|
||||
|
||||
if ('js' === $format) {
|
||||
return 'js';
|
||||
}
|
||||
|
||||
if ('txt' === $format) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 'html';
|
||||
return TwigDefaultEscapingStrategy::guess($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,18 +17,18 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/twig-bridge": "~2.6",
|
||||
"symfony/http-foundation": "~2.5",
|
||||
"symfony/http-kernel": "~2.1"
|
||||
"symfony/twig-bridge": "~2.6|~3.0.0",
|
||||
"symfony/http-foundation": "~2.5|~3.0.0",
|
||||
"symfony/http-kernel": "~2.1|~3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/stopwatch": "~2.2",
|
||||
"symfony/dependency-injection": "~2.2",
|
||||
"symfony/expression-language": "~2.4",
|
||||
"symfony/config": "~2.2",
|
||||
"symfony/routing": "~2.1",
|
||||
"symfony/templating": "~2.1",
|
||||
"symfony/framework-bundle": "~2.1"
|
||||
"symfony/stopwatch": "~2.2|~3.0.0",
|
||||
"symfony/dependency-injection": "~2.2|~3.0.0",
|
||||
"symfony/expression-language": "~2.4|~3.0.0",
|
||||
"symfony/config": "~2.2|~3.0.0",
|
||||
"symfony/routing": "~2.1|~3.0.0",
|
||||
"symfony/templating": "~2.1|~3.0.0",
|
||||
"symfony/framework-bundle": "~2.1|~3.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" }
|
||||
|
|
|
@ -24,7 +24,7 @@ class WebProfilerExtensionTest extends TestCase
|
|||
{
|
||||
private $kernel;
|
||||
/**
|
||||
* @var Symfony\Component\DependencyInjection\Container
|
||||
* @var \Symfony\Component\DependencyInjection\Container
|
||||
*/
|
||||
private $container;
|
||||
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/http-kernel": "~2.4",
|
||||
"symfony/routing": "~2.2",
|
||||
"symfony/twig-bridge": "~2.2"
|
||||
"symfony/http-kernel": "~2.4|~3.0.0",
|
||||
"symfony/routing": "~2.2|~3.0.0",
|
||||
"symfony/twig-bridge": "~2.2|~3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.2",
|
||||
"symfony/console": "~2.3",
|
||||
"symfony/dependency-injection": "~2.2",
|
||||
"symfony/stopwatch": "~2.2"
|
||||
"symfony/config": "~2.2|~3.0.0",
|
||||
"symfony/console": "~2.3|~3.0.0",
|
||||
"symfony/dependency-injection": "~2.2|~3.0.0",
|
||||
"symfony/stopwatch": "~2.2|~3.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Symfony\\Bundle\\WebProfilerBundle\\": "" }
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace Symfony\Component\BrowserKit\Tests;
|
|||
use Symfony\Component\BrowserKit\Client;
|
||||
use Symfony\Component\BrowserKit\History;
|
||||
use Symfony\Component\BrowserKit\CookieJar;
|
||||
use Symfony\Component\BrowserKit\Request;
|
||||
use Symfony\Component\BrowserKit\Response;
|
||||
|
||||
class SpecialResponse extends Response
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/dom-crawler": "~2.0,>=2.0.5"
|
||||
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/process": "~2.0,>=2.0.5",
|
||||
"symfony/css-selector": "~2.0,>=2.0.5"
|
||||
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
|
||||
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/process": ""
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/finder": "~2.0,>=2.0.5"
|
||||
"symfony/finder": "~2.0,>=2.0.5|~3.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Symfony\\Component\\ClassLoader\\": "" }
|
||||
|
|
|
@ -192,7 +192,7 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
*
|
||||
* @param mixed $val The value that the closure must return
|
||||
*
|
||||
* @return Closure
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function returnClosure($val)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Config\Tests\Definition\Builder;
|
|||
|
||||
use Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder as CustomNodeBuilder;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
|
||||
|
||||
require __DIR__.'/../../Fixtures/Builder/NodeBuilder.php';
|
||||
require __DIR__.'/../../Fixtures/Builder/BarNodeDefinition.php';
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Config\Tests\Loader;
|
|||
|
||||
use Symfony\Component\Config\Loader\FileLoader;
|
||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
||||
use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException;
|
||||
|
||||
class FileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/filesystem": "~2.3"
|
||||
"symfony/filesystem": "~2.3|~3.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Symfony\\Component\\Config\\": "" }
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/event-dispatcher": "~2.1",
|
||||
"symfony/process": "~2.1",
|
||||
"symfony/event-dispatcher": "~2.1|~3.0.0",
|
||||
"symfony/process": "~2.1|~3.0.0",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"suggest": {
|
||||
|
|
|
@ -24,7 +24,7 @@ use Symfony\Component\CssSelector\XPath\Translator;
|
|||
*
|
||||
* $xpath = CssSelector::toXpath('h1.foo');
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* Copyright (c) 2007-2012 Ian Bicking and contributors. See AUTHORS
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Exception;
|
|||
/**
|
||||
* Interface for exceptions.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Exception;
|
|||
/**
|
||||
* ParseException is thrown when a CSS selector syntax is not valid.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Exception;
|
|||
/**
|
||||
* ParseException is thrown when a CSS selector syntax is not valid.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Exception;
|
|||
/**
|
||||
* ParseException is thrown when a CSS selector syntax is not valid.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Parser\Token;
|
|||
/**
|
||||
* ParseException is thrown when a CSS selector syntax is not valid.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Abstract base node class.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>[<namespace>|<attribute> <operator> <value>]" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>.<name>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a combined node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<namespace>|<element>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Parser\Token;
|
|||
/**
|
||||
* Represents a "<selector>:<name>(<arguments>)" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>#<id>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>:not(<identifier>)" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Interface for nodes.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>:<identifier>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a "<selector>(::|:)<pseudoElement>" node.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Node;
|
|||
/**
|
||||
* Represents a node specificity.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @see http://www.w3.org/TR/selectors/#specificity
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
|||
/**
|
||||
* CSS selector handler interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -20,7 +20,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -20,7 +20,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -22,7 +22,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
|||
/**
|
||||
* CSS selector comment handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
|||
/**
|
||||
* CSS selector whitespace handler.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\Tokenizer;
|
|||
/**
|
||||
* CSS selector parser.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Node\SelectorNode;
|
|||
/**
|
||||
* CSS selector parser interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Parser;
|
|||
/**
|
||||
* CSS selector reader.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
/**
|
||||
* CSS selector class parser shortcut.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
/**
|
||||
* CSS selector element parser shortcut.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -22,7 +22,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
* - The parser fails to parse an empty string.
|
||||
* - In the previous version, an empty string matches each tags.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
/**
|
||||
* CSS selector hash parser shortcut.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Parser;
|
|||
/**
|
||||
* CSS selector token.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
|
|||
/**
|
||||
* CSS selector token stream.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
|||
/**
|
||||
* CSS selector tokenizer.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
|||
/**
|
||||
* CSS selector tokenizer escaping applier.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
|||
/**
|
||||
* CSS selector tokenizer patterns builder.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -36,10 +36,9 @@ names are lower-cased, the following extra pseudo-classes are supported:
|
|||
Resources
|
||||
---------
|
||||
|
||||
This component is a port of the Python lxml library, which is copyright Infrae
|
||||
and distributed under the BSD license.
|
||||
|
||||
Current code is a port of https://github.com/SimonSapin/cssselect/releases/tag/v0.7.1
|
||||
This component is a port of the Python cssselect library
|
||||
[v0.7.1](https://github.com/SimonSapin/cssselect/releases/tag/v0.7.1),
|
||||
which is distributed under the BSD license.
|
||||
|
||||
You can run the unit tests with the following command:
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\XPath\Extension;
|
|||
/**
|
||||
* XPath expression translator abstract extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator attribute extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator combination extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\XPath\Extension;
|
|||
/**
|
||||
* XPath expression translator extension interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -21,7 +21,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator function extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator HTML extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator node extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
|
|||
/**
|
||||
* XPath expression translator pseudo-class extension.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -21,7 +21,7 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
|||
/**
|
||||
* XPath expression translator interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\CssSelector\Node\SelectorNode;
|
|||
/**
|
||||
* XPath expression translator interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\CssSelector\XPath;
|
|||
/**
|
||||
* XPath expression translator interface.
|
||||
*
|
||||
* This component is a port of the Python cssselector library,
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
"psr/log": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/http-kernel": "~2.2",
|
||||
"symfony/http-foundation": "~2.1"
|
||||
"symfony/http-kernel": "~2.2|~3.0.0",
|
||||
"symfony/http-foundation": "~2.1|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/http-foundation": "",
|
||||
|
|
|
@ -16,7 +16,6 @@ require_once __DIR__.'/Fixtures/includes/ProjectExtension.php';
|
|||
|
||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
||||
use Symfony\Component\DependencyInjection\Alias;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container->
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader;
|
|||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\Config\Loader\Loader;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/yaml": "~2.1",
|
||||
"symfony/config": "~2.2",
|
||||
"symfony/expression-language": "~2.6"
|
||||
"symfony/yaml": "~2.1|~3.0.0",
|
||||
"symfony/config": "~2.2|~3.0.0",
|
||||
"symfony/expression-language": "~2.6|~3.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/yaml": "",
|
||||
|
|
|
@ -23,7 +23,7 @@ use Symfony\Component\CssSelector\CssSelector;
|
|||
class Crawler extends \SplObjectStorage
|
||||
{
|
||||
/**
|
||||
* @var string The current URI or the base href value
|
||||
* @var string The current URI
|
||||
*/
|
||||
protected $uri;
|
||||
|
||||
|
@ -37,17 +37,23 @@ class Crawler extends \SplObjectStorage
|
|||
*/
|
||||
private $namespaces = array();
|
||||
|
||||
/**
|
||||
* @var string The base href value
|
||||
*/
|
||||
private $baseHref;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param mixed $node A Node to use as the base for the crawling
|
||||
* @param string $uri The current URI or the base href value
|
||||
*
|
||||
* @param string $currentUri The current URI
|
||||
* @param string $baseHref The base href value
|
||||
* @api
|
||||
*/
|
||||
public function __construct($node = null, $uri = null)
|
||||
public function __construct($node = null, $currentUri = null, $baseHref = null)
|
||||
{
|
||||
$this->uri = $uri;
|
||||
$this->uri = $currentUri;
|
||||
$this->baseHref = $baseHref ?: $currentUri;
|
||||
|
||||
$this->add($node);
|
||||
}
|
||||
|
@ -186,13 +192,13 @@ class Crawler extends \SplObjectStorage
|
|||
|
||||
$baseHref = current($base);
|
||||
if (count($base) && !empty($baseHref)) {
|
||||
if ($this->uri) {
|
||||
if ($this->baseHref) {
|
||||
$linkNode = $dom->createElement('a');
|
||||
$linkNode->setAttribute('href', $baseHref);
|
||||
$link = new Link($linkNode, $this->uri);
|
||||
$this->uri = $link->getUri();
|
||||
$link = new Link($linkNode, $this->baseHref);
|
||||
$this->baseHref = $link->getUri();
|
||||
} else {
|
||||
$this->uri = $baseHref;
|
||||
$this->baseHref = $baseHref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,11 +314,11 @@ class Crawler extends \SplObjectStorage
|
|||
{
|
||||
foreach ($this as $i => $node) {
|
||||
if ($i == $position) {
|
||||
return new static($node, $this->uri);
|
||||
return new static($node, $this->uri, $this->baseHref);
|
||||
}
|
||||
}
|
||||
|
||||
return new static(null, $this->uri);
|
||||
return new static(null, $this->uri, $this->baseHref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -337,7 +343,7 @@ class Crawler extends \SplObjectStorage
|
|||
{
|
||||
$data = array();
|
||||
foreach ($this as $i => $node) {
|
||||
$data[] = $closure(new static($node, $this->uri), $i);
|
||||
$data[] = $closure(new static($node, $this->uri, $this->baseHref), $i);
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
@ -371,12 +377,12 @@ class Crawler extends \SplObjectStorage
|
|||
{
|
||||
$nodes = array();
|
||||
foreach ($this as $i => $node) {
|
||||
if (false !== $closure(new static($node, $this->uri), $i)) {
|
||||
if (false !== $closure(new static($node, $this->uri, $this->baseHref), $i)) {
|
||||
$nodes[] = $node;
|
||||
}
|
||||
}
|
||||
|
||||
return new static($nodes, $this->uri);
|
||||
return new static($nodes, $this->uri, $this->baseHref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -418,7 +424,7 @@ class Crawler extends \SplObjectStorage
|
|||
throw new \InvalidArgumentException('The current node list is empty.');
|
||||
}
|
||||
|
||||
return new static($this->sibling($this->getNode(0)->parentNode->firstChild), $this->uri);
|
||||
return new static($this->sibling($this->getNode(0)->parentNode->firstChild), $this->uri, $this->baseHref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -436,7 +442,7 @@ class Crawler extends \SplObjectStorage
|
|||
throw new \InvalidArgumentException('The current node list is empty.');
|
||||
}
|
||||
|
||||
return new static($this->sibling($this->getNode(0)), $this->uri);
|
||||
return new static($this->sibling($this->getNode(0)), $this->uri, $this->baseHref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -454,7 +460,7 @@ class Crawler extends \SplObjectStorage
|
|||
throw new \InvalidArgumentException('The current node list is empty.');
|
||||
}
|
||||
|
||||
return new static($this->sibling($this->getNode(0), 'previousSibling'), $this->uri);
|
||||
return new static($this->sibling($this->getNode(0), 'previousSibling'), $this->uri, $this->baseHref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -481,7 +487,7 @@ class Crawler extends \SplObjectStorage
|
|||
}
|
||||
}
|
||||
|
||||
return new static($nodes, $this->uri);
|
||||
return new static($nodes, $this->uri, $this->baseHref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -501,7 +507,7 @@ class Crawler extends \SplObjectStorage
|
|||
|
||||
$node = $this->getNode(0)->firstChild;
|
||||
|
||||
return new static($node ? $this->sibling($node) : array(), $this->uri);
|
||||
return new static($node ? $this->sibling($node) : array(), $this->uri, $this->baseHref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -646,7 +652,7 @@ class Crawler extends \SplObjectStorage
|
|||
|
||||
// If we dropped all expressions in the XPath while preparing it, there would be no match
|
||||
if ('' === $xpath) {
|
||||
return new static(null, $this->uri);
|
||||
return new static(null, $this->uri, $this->baseHref);
|
||||
}
|
||||
|
||||
return $this->filterRelativeXPath($xpath);
|
||||
|
@ -730,7 +736,7 @@ class Crawler extends \SplObjectStorage
|
|||
|
||||
$node = $this->getNode(0);
|
||||
|
||||
return new Link($node, $this->uri, $method);
|
||||
return new Link($node, $this->baseHref, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -744,7 +750,7 @@ class Crawler extends \SplObjectStorage
|
|||
{
|
||||
$links = array();
|
||||
foreach ($this as $node) {
|
||||
$links[] = new Link($node, $this->uri, 'get');
|
||||
$links[] = new Link($node, $this->baseHref, 'get');
|
||||
}
|
||||
|
||||
return $links;
|
||||
|
@ -856,7 +862,7 @@ class Crawler extends \SplObjectStorage
|
|||
{
|
||||
$prefixes = $this->findNamespacePrefixes($xpath);
|
||||
|
||||
$crawler = new static(null, $this->uri);
|
||||
$crawler = new static(null, $this->uri, $this->baseHref);
|
||||
|
||||
foreach ($this as $node) {
|
||||
$domxpath = $this->createDOMXPath($node->ownerDocument, $prefixes);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue