Skip to content

Commit 9a07129

Browse files
committed
Set up basic library scaffolding
1 parent 3b7ef87 commit 9a07129

14 files changed

+246
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
antispam:
2+
stealth: false
3+
4+
profiles:
5+
test1:
6+
stealth: false
7+
8+
banned_markup: true
9+
banned_phrases:
10+
- 'official partner of Wordpress'
11+
- 'with hourly rate'
12+
- 'expert developers'
13+
14+
banned_scripts:
15+
- cyrillic
16+
- arabic
17+
18+
timer:
19+
min: 15
20+
max: 900
21+
field: '__custom_timer_field'
22+
23+
url_count:
24+
max: 2
25+
max_identical: 1
26+
27+
honeypot: email_address
28+
29+
test2:
30+
url_count: 1
31+
32+
banned_markup: true
33+
banned_phrases: ['viagra']
34+
banned_scripts: cyrillic
35+
36+
honeypot:
37+
field: message
38+
attributes:
39+
class: "d-none"
40+
41+
test3:
42+
timer:
43+
min: 1.2
44+
max: 68.4
45+
honeypot: email
46+
47+
stealthy_empty:
48+
stealth: true
49+
50+
banned_phrases: ['spam']
51+
52+
passive_empty:
53+
passive: true
54+
55+
banned_phrases: ['spam']
56+
57+
empty:
58+
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
framework:
2+
cache:
3+
# Unique name of your app: used to compute stable namespaces for cache keys.
4+
#prefix_seed: your_vendor_name/app_name
5+
6+
# The "app" cache stores to the filesystem by default.
7+
# The data in this cache should persist between deploys.
8+
# Other options include:
9+
10+
# Redis
11+
#app: cache.adapter.redis
12+
#default_redis_provider: redis://localhost
13+
14+
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
15+
#app: cache.adapter.apcu
16+
17+
# Namespaced pools use the above "app" backend by default
18+
#pools:
19+
#my.dedicated.cache: null
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
monolog:
2+
channels:
3+
- deprecation
4+
5+
when@test:
6+
monolog:
7+
handlers:
8+
test:
9+
type: test
10+
level: debug
11+
channels: ['antispam']
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
framework:
2+
router:
3+
utf8: true
4+
5+
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
6+
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
7+
#default_uri: http://localhost
8+
9+
when@prod:
10+
framework:
11+
router:
12+
strict_requirements: null
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
twig:
2+
default_path: '%kernel.project_dir%/templates'
3+
form_themes: ['bootstrap_5_layout.html.twig']
4+
5+
when@test:
6+
twig:
7+
strict_variables: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
framework:
2+
validation:
3+
email_validation_mode: html5
4+
5+
# Enables validator auto-mapping support.
6+
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
7+
#auto_mapping:
8+
# App\Entity\: []
9+
10+
when@test:
11+
framework:
12+
validation:
13+
not_compromised_password: false

tests/Fixture/config/routes.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
controllers:
2+
resource:
3+
path: ../src/Controller/
4+
namespace: Tests\Fixture\Controller
5+
type: attribute
6+
prefix: /{_locale}
7+
requirements:
8+
_locale: '%locales%'
9+
defaults:
10+
_locales: '%default_locale%'
11+
12+
root:
13+
path: /
14+
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
15+
defaults:
16+
route: home

tests/Fixture/public/index.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
use Tests\Fixture\Kernel;
4+
5+
// This allows us to do the trick with the symlinked vendor folder shared with the main library
6+
$_SERVER['APP_RUNTIME_OPTIONS'] = ['project_dir' => dirname(__DIR__)];
7+
8+
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';
9+
10+
return function () {
11+
return new Kernel('dev', true);
12+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/*
4+
* Symfony Anti-Spam Quarantine Bundle
5+
* (c) Omines Internetbureau B.V. - https://omines.nl/
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
declare(strict_types=1);
12+
13+
namespace Tests\Fixture\Controller;
14+
15+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
16+
use Symfony\Component\HttpFoundation\Request;
17+
use Symfony\Component\HttpFoundation\Response;
18+
use Symfony\Component\Routing\Attribute\Route;
19+
20+
class PageController extends AbstractController
21+
{
22+
#[Route('/', 'home')]
23+
public function homeAction(Request $request): Response
24+
{
25+
return $this->render('home.html.twig');
26+
}
27+
}

tests/Fixture/src/Kernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* Symfony Anti-Spam Bundle
4+
* Symfony Anti-Spam Quarantine Bundle
55
* (c) Omines Internetbureau B.V. - https://omines.nl/
66
*
77
* For the full copyright and license information, please view the LICENSE
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{% set title = title|default('Omines Anti-Spam Quarantine Bundle Test Site') %}
2+
<!DOCTYPE html>
3+
<html lang="{{ app.request.locale }}" data-bs-theme="dark">
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<title>{{ title }}</title>
8+
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
9+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
10+
{% block stylesheets %}
11+
{% endblock %}
12+
13+
{% block javascripts %}
14+
{% endblock %}
15+
</head>
16+
<body>
17+
<header class="navbar navbar-expand bg-body-tertiary">
18+
<div class="container">
19+
<a class="navbar-brand" href="/">{{ title }}</a>
20+
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
21+
<li class="nav-item dropdown">
22+
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
23+
{% trans %}Languages{% endtrans %}
24+
</a>
25+
<ul class="dropdown-menu">
26+
{# {% for language in languages %}#}
27+
{# <li><a class="dropdown-item" href="/{{ language }}/">{{ ('languages.native.' ~ language)|trans }}</a></li>#}
28+
{# {% endfor %}#}
29+
</ul>
30+
</li>
31+
</ul>
32+
</div>
33+
</header>
34+
<main class="container my-3">
35+
{% for message in app.session.flashBag.get('message') %}
36+
<div class="alert alert-primary alert-dismissible fade show">
37+
{{ message }}
38+
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
39+
</div>
40+
{% endfor %}
41+
{% block body %}{% endblock %}
42+
</main>
43+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
44+
</body>
45+
</html>
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% extends 'base.html.twig' %}
2+
3+
{% block body %}
4+
<div class="row">
5+
<div class="col-xxl-6 col-xl-8 col-lg-10">
6+
Form.
7+
</div>
8+
</div>
9+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Name: Name
2+
Email: Email
3+
Message: Message
4+
Submit: Submit
5+
6+
languages: Languages
7+
languages.native:
8+
en: English
9+
fr: Français
10+
de: Deutsch
11+
nl: Nederlands
12+
ru: русский
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Name: Naam
2+
Email: Emailadres
3+
Message: Bericht
4+
Submit: Versturen

0 commit comments

Comments
 (0)