-
-
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
Showing
22 changed files
with
814 additions
and
718 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,79 @@ | ||
<?php | ||
|
||
$header = <<<EOF | ||
This file is part of the Contao Simple News URLs extension. | ||
(c) inspiredminds | ||
@license LGPL-3.0-or-later | ||
EOF; | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in([ | ||
__DIR__.'/contao', | ||
__DIR__.'/src', | ||
]) | ||
; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'@PHP71Migration' => true, | ||
'@PHP71Migration:risky' => true, | ||
'@PHPUnit60Migration:risky' => true, | ||
'align_multiline_comment' => true, | ||
'array_indentation' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'combine_consecutive_issets' => true, | ||
'combine_consecutive_unsets' => true, | ||
'comment_to_phpdoc' => true, | ||
'compact_nullable_typehint' => true, | ||
'escape_implicit_backslashes' => true, | ||
'fully_qualified_strict_types' => true, | ||
'general_phpdoc_annotation_remove' => [ | ||
'annotations' => [ | ||
'author', | ||
'expectedException', | ||
'expectedExceptionMessage', | ||
], | ||
], | ||
'header_comment' => ['header' => $header], | ||
'heredoc_to_nowdoc' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'list_syntax' => ['syntax' => 'short'], | ||
'multiline_comment_opening_closing' => true, | ||
'multiline_whitespace_before_semicolons' => [ | ||
'strategy' => 'new_line_for_chained_calls', | ||
], | ||
'native_function_invocation' => [ | ||
'include' => ['@compiler_optimized'], | ||
], | ||
'no_alternative_syntax' => true, | ||
'no_binary_string' => true, | ||
'no_null_property_initialization' => true, | ||
'no_superfluous_elseif' => true, | ||
'no_superfluous_phpdoc_tags' => true, | ||
'no_unreachable_default_argument_value' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'ordered_class_elements' => true, | ||
'ordered_imports' => true, | ||
'php_unit_strict' => true, | ||
'phpdoc_add_missing_param_annotation' => true, | ||
'phpdoc_order' => true, | ||
'phpdoc_trim_consecutive_blank_line_separation' => true, | ||
'phpdoc_types_order' => [ | ||
'null_adjustment' => 'always_last', | ||
'sort_algorithm' => 'none', | ||
], | ||
'return_assignment' => true, | ||
'strict_comparison' => true, | ||
'strict_param' => true, | ||
'string_line_ending' => true, | ||
'void_return' => true, | ||
]) | ||
->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
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
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 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
|
||
InspiredMinds\ContaoSimpleNewsUrls\: | ||
resource: ../src | ||
|
||
contao_simple_news_urls.routing.router: | ||
class: Symfony\Cmf\Component\Routing\DynamicRouter | ||
arguments: | ||
- '@router.request_context' | ||
- '@contao_simple_news_urls.routing.nested_matcher' | ||
- '@contao_simple_news_urls.routing.route_generator' | ||
- '' | ||
- '@event_dispatcher' | ||
- '@InspiredMinds\ContaoSimpleNewsUrls\Routing\RouteProvider' | ||
tags: | ||
- { name: router, priority: 70 } | ||
|
||
contao_simple_news_urls.routing.nested_matcher: | ||
class: Symfony\Cmf\Component\Routing\NestedMatcher\NestedMatcher | ||
arguments: | ||
- '@InspiredMinds\ContaoSimpleNewsUrls\Routing\RouteProvider' | ||
- '@contao_simple_news_urls.routing.final_matcher' | ||
|
||
contao_simple_news_urls.routing.final_matcher: | ||
class: Symfony\Cmf\Component\Routing\NestedMatcher\UrlMatcher | ||
arguments: | ||
- '@contao_simple_news_urls.routing.dummy_collection' | ||
- '@contao_simple_news_urls.routing.dummy_context' | ||
|
||
contao_simple_news_urls.routing.dummy_context: | ||
class: Symfony\Component\Routing\RequestContext | ||
|
||
contao_simple_news_urls.routing.dummy_collection: | ||
class: Symfony\Component\Routing\RouteCollection | ||
|
||
contao_simple_news_urls.routing.route_generator: | ||
class: Symfony\Cmf\Component\Routing\ProviderBasedGenerator | ||
arguments: | ||
- '@InspiredMinds\ContaoSimpleNewsUrls\Routing\RouteProvider' | ||
- '@logger' |
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Contao Simple News URLs extension. | ||
* | ||
* (c) inspiredminds | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
use Contao\CoreBundle\DataContainer\PaletteManipulator; | ||
|
||
$GLOBALS['TL_DCA']['tl_news_archive']['fields']['enable_simple_urls'] = [ | ||
'exclude' => true, | ||
'filter' => true, | ||
'inputType' => 'checkbox', | ||
'eval' => ['tl_class' => 'w50'], | ||
'sql' => ['type' => 'boolean', 'default' => false], | ||
]; | ||
|
||
PaletteManipulator::create() | ||
->addLegend('simpleurls_legend', null) | ||
->addField('enable_simple_urls', 'simpleurls_legend', PaletteManipulator::POSITION_APPEND) | ||
->applyToPalette('default', 'tl_news_archive') | ||
; |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Contao Simple News URLs extension. | ||
* | ||
* (c) inspiredminds | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
$GLOBALS['TL_LANG']['tl_news_archive']['simpleurls_legend'] = 'Einfache Nachrichten-URLs'; | ||
$GLOBALS['TL_LANG']['tl_news_archive']['enable_simple_urls'] = ['Einfache Nachrichten-URLs aktivieren', 'Aktiviert Nachrichten-URLs in der Form <code>example.com/<news-alias></code> für dieses Nachrichtenarchiv.']; |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Contao Simple News URLs extension. | ||
* | ||
* (c) inspiredminds | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
$GLOBALS['TL_LANG']['tl_news_archive']['simpleurls_legend'] = 'Simple news URLs'; | ||
$GLOBALS['TL_LANG']['tl_news_archive']['enable_simple_urls'] = ['Enable simple news URLs', 'Enables news URLs in the format of <code>example.com/<news-alias></code> for news articles of this news archive.']; |
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Contao Simple News URLs extension. | ||
* | ||
* (c) inspiredminds | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace InspiredMinds\ContaoSimpleNewsUrls\ContaoManager; | ||
|
||
use Contao\ManagerPlugin\Bundle\BundlePluginInterface; | ||
use Contao\ManagerPlugin\Bundle\Config\BundleConfig; | ||
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface; | ||
use Contao\NewsBundle\ContaoNewsBundle; | ||
use InspiredMinds\ContaoSimpleNewsUrls\ContaoSimpleNewsUrlsBundle; | ||
|
||
class Plugin implements BundlePluginInterface | ||
{ | ||
public function getBundles(ParserInterface $parser): array | ||
{ | ||
return [ | ||
BundleConfig::create(ContaoSimpleNewsUrlsBundle::class) | ||
->setLoadAfter([ContaoNewsBundle::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 | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Contao Simple News URLs extension. | ||
* | ||
* (c) inspiredminds | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace InspiredMinds\ContaoSimpleNewsUrls; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class ContaoSimpleNewsUrlsBundle extends Bundle | ||
{ | ||
public function getPath(): string | ||
{ | ||
return \dirname(__DIR__); | ||
} | ||
} |
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Contao Simple News URLs extension. | ||
* | ||
* (c) inspiredminds | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace InspiredMinds\ContaoSimpleNewsUrls\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | ||
|
||
class ContaoSimpleNewsUrlsExtension extends Extension | ||
{ | ||
public function load(array $configs, ContainerBuilder $container): void | ||
{ | ||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../config')); | ||
$loader->load('services.yaml'); | ||
} | ||
} |
Oops, something went wrong.