-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Konstantin Wagner
committed
Mar 13, 2018
1 parent
1702966
commit 881dc5c
Showing
28 changed files
with
1,544 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/vendor | ||
.idea | ||
composer.lock | ||
Thumbs.db | ||
.DS_Store | ||
.sass-cache | ||
component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
$date = date('Y'); | ||
|
||
$header = <<<EOF | ||
Copyright (c) $date Heimrich & Hannot GmbH | ||
@license LGPL-3.0-or-later | ||
EOF; | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->exclude('Resources') | ||
->exclude('Fixtures') | ||
->in([__DIR__.'/src', __DIR__.'/tests']) | ||
; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'psr0' => false, | ||
'strict_comparison' => true, | ||
'strict_param' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'heredoc_to_nowdoc' => true, | ||
'header_comment' => ['header' => $header], | ||
'ordered_imports' => true, | ||
'ordered_class_elements' => true, | ||
'php_unit_strict' => true, | ||
'phpdoc_order' => true, | ||
'no_useless_return' => true, | ||
'no_useless_else' => true, | ||
'no_unreachable_default_argument_value' => true, | ||
'combine_consecutive_unsets' => true, | ||
'general_phpdoc_annotation_remove' => [ | ||
'expectedException', | ||
'expectedExceptionMessage', | ||
], | ||
]) | ||
->setFinder($finder) | ||
->setRiskyAllowed(true) | ||
->setUsingCache(false) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
language: php | ||
git: | ||
depth: 1 | ||
cache: | ||
directories: | ||
- "$HOME/.composer/cache" | ||
sudo: false | ||
env: | ||
global: | ||
- COMPOSER_ALLOW_XDEBUG=0 | ||
matrix: | ||
include: | ||
- php: 7.1 | ||
env: CONTAO_VERSION='4.4.*' | ||
- php: 7.2 | ||
env: CONTAO_VERSION='4.4.*' | ||
- php: 7.1 | ||
env: CONTAO_VERSION='4.5.*' | ||
- php: 7.2 | ||
env: CONTAO_VERSION='4.5.*' | ||
- php: 7.2 | ||
env: COVERAGE=1 CONTAO_VERSION='4.5.*' | ||
allow_failures: | ||
- env: COVERAGE=1 DEFAULT=0 | ||
fast_finish: true | ||
before_install: | ||
- if [[ "$COVERAGE" != "1" ]]; then phpenv config-rm xdebug.ini || true; fi | ||
install: | ||
- composer require contao/core-bundle:${CONTAO_VERSION} | ||
- if [[ "$UPDATEDOC" = "1" ]]; then wget -O sami.phar http://get.sensiolabs.org/sami.phar; fi | ||
notifications: | ||
email: | ||
recipients: | ||
- digitales@heimrich-hannot.de | ||
on_success: never | ||
on_failure: always | ||
hipchat: | ||
rooms: | ||
secure: rgKkEZcd1kENwBFU1Paf8j2arSuOw71ew20RH68XlXcHT07ywwgum+/tgIQVLpVI/LHwImVVLdAd3OXJyCgN2+wrl6O++fjvBxvi0mpAb64JcxRgTWguv4JoBDZzvq5SCmDej2hPvCh339b6a4ExGDqRHKjPn2+NKNW/YYaW0mvoun6UTXlErULVJOjiUONG1ePIVXpl3qmA2fye/LJQpBi3AdpSI7bNiv/Xj+LfG6XGjicHcY0Xd1ir0kmFf9lT4jtjcCz0zVjW6XbzdCZLfbnadHcvaDy3yh0ZgWsbEvGDR18BhINGADOs5Zzy4dU1nQqdf0wkp8qMWztJy7dFDhBTFGVPXoFOgv9FVxJLjuRc+u+wA4bPW8iQ2HU5dGFXyqyDUPzwZ9HWX/KNy32Iq9blZSCnw6FeLe09cO9MVB61zjZDcxHpzB2J23c7J/pSVo4+aTZGoMZZmIFNxxpoeNdm1PWpafYRJrxDnJO9nOfjSRWEU3mHudEcYzZAN0Amegp4jK/6I88/auOgln3eVpADAq/s85MbSt8q41y97Zs7peBDOfJm+ZWuBj6/4Ya2S2/vsNtz/RA0yywpdvJ/ZZUHOIKij39iNWkuynqC5/5t5jExcbc4Taay6Mvjixyk7/ibbpYOwpZ54ycBSOjLzMoiyyMKjK7dKCrl+SrsZ70= | ||
before_script: | ||
- travis_wait composer install --no-interaction | ||
script: | ||
- if [[ "$COVERAGE" = "1" ]]; then travis_retry mkdir -p build/logs; fi | ||
- if [[ "$COVERAGE" = "1" ]]; then travis_retry php vendor/bin/phpunit --coverage-clover build/logs/clover.xml || true; fi | ||
- if [[ "$UPDATEDOC" = "1" ]]; then travis_retry php sami.phar update ./docs/config/SamiDocConfig.php || true; fi | ||
after_script: | ||
- if [[ "$COVERAGE" = "1" ]]; then travis_retry php vendor/bin/php-coveralls -v; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"name": "heimrichhannot/contao-ajax-bundle", | ||
"description": "Keep contao ajax requests organized and handle responses with ease.", | ||
"keywords": [ | ||
"contao", | ||
"ajax", | ||
"request", | ||
"response" | ||
], | ||
"type": "contao-bundle", | ||
"homepage": "https://github.com/heimrichhannot/contao-ajax-bundle", | ||
"license": "LGPL-3.0-or-later", | ||
"authors": [ | ||
{ | ||
"name": "Heimrich & Hannot", | ||
"email": "digitales@heimrich-hannot.de", | ||
"homepage": "http://www.heimrich-hannot.de", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.1", | ||
"contao/core-bundle": "^4.4", | ||
"symfony/framework-bundle": "^3.4", | ||
"heimrichhannot/contao-utils-bundle": "^2.0" | ||
}, | ||
"require-dev": { | ||
"contao/test-case": "^1.1", | ||
"contao/manager-plugin": "^2.0", | ||
"friendsofphp/php-cs-fixer": "^2.2", | ||
"phpunit/phpunit": ">=6.0 <6.5", | ||
"php-http/guzzle6-adapter": "^1.1", | ||
"php-http/message-factory": "^1.0.2", | ||
"php-coveralls/php-coveralls": "^2.0", | ||
"symfony/phpunit-bridge": "^3.2" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"HeimrichHannot\\AjaxBundle\\": "src/" | ||
}, | ||
"classmap": [ | ||
"src/" | ||
], | ||
"exclude-from-classmap": [ | ||
"src/Resources/contao/config/", | ||
"src/Resources/contao/dca/", | ||
"src/Resources/contao/languages/", | ||
"src/Resources/contao/templates/" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"HeimrichHannot\\AjaxBundle\\Test\\": "tests/" | ||
} | ||
}, | ||
"config": { | ||
"preferred-install": "dist" | ||
}, | ||
"extra": { | ||
"contao": { | ||
"sources": { | ||
"": "system/modules/ajax" | ||
} | ||
}, | ||
"contao-manager-plugin": "HeimrichHannot\\AjaxBundle\\ContaoManager\\Plugin" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
bootstrap="tests/bootstrap.php" | ||
failOnRisky="true" | ||
failOnWarning="true"> | ||
<php> | ||
<ini name="error_reporting" value="-1"/> | ||
<ini name="display_errors" value="1"/> | ||
<ini name="display_startup_errors" value="1"/> | ||
<ini name="intl.default_locale" value="en"/> | ||
<ini name="intl.error_level" value="0"/> | ||
</php> | ||
|
||
<testsuites> | ||
<testsuite name="Unit Tests"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory>./src</directory> | ||
<exclude> | ||
<directory>./src/Resources</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle\Backend; | ||
|
||
use Contao\System; | ||
|
||
class Hooks | ||
{ | ||
/** | ||
* Contao initialize.php hook before request token validation happend. | ||
*/ | ||
public function initializeSystemHook() | ||
{ | ||
if (System::getContainer()->get('huh.utils.container')->isBackend()) { | ||
return; | ||
} | ||
|
||
if (!System::getContainer()->get('huh.request')->isXmlHttpRequest()) { | ||
return; | ||
} | ||
|
||
// improved REQUEST_TOKEN handling within front end mode | ||
if (System::getContainer()->get('huh.request')->isMethod('POST') && !\RequestToken::validate(System::getContainer()->get('huh.request')->getPost('REQUEST_TOKEN'))) { | ||
System::getContainer()->get('huh.ajax')->setRequestTokenExpired(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle\ContaoManager; | ||
|
||
use Contao\CoreBundle\ContaoCoreBundle; | ||
use Contao\ManagerPlugin\Bundle\BundlePluginInterface; | ||
use Contao\ManagerPlugin\Bundle\Config\BundleConfig; | ||
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface; | ||
use HeimrichHannot\AjaxBundle\HeimrichHannotContaoAjaxBundle; | ||
|
||
class Plugin implements BundlePluginInterface | ||
{ | ||
public function getBundles(ParserInterface $parser) | ||
{ | ||
return [ | ||
BundleConfig::create(HeimrichHannotContaoAjaxBundle::class)->setLoadAfter([ContaoCoreBundle::class]), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | ||
|
||
class AjaxExtension extends Extension | ||
{ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
$loader->load('services.yml'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle\Exception; | ||
|
||
class AjaxExitException extends \Exception | ||
{ | ||
const CODE_NORMAL_EXIT = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle; | ||
|
||
use HeimrichHannot\AjaxBundle\DependencyInjection\AjaxExtension; | ||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class HeimrichHannotContaoAjaxBundle extends Bundle | ||
{ | ||
/** | ||
* @return AjaxExtension | ||
*/ | ||
public function getContainerExtension() | ||
{ | ||
return new AjaxExtension(); | ||
} | ||
} |
Oops, something went wrong.