Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit 97031b0

Browse files
committed
Initial commit
0 parents  commit 97031b0

File tree

6 files changed

+171
-0
lines changed

6 files changed

+171
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,json}]
15+
indent_style = space
16+
indent_size = 2

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# OS files
2+
.DS_Store
3+
4+
# npm modules
5+
/node_modules
6+
7+
# PhpStorm
8+
/.idea
9+
10+
# files of Composer dependencies that are not needed for the plugin
11+
/vendor/**/.*
12+
/vendor/**/*.json
13+
/vendor/**/*.txt
14+
/vendor/**/*.md
15+
/vendor/**/*.yml
16+
/vendor/**/*.yaml
17+
/vendor/**/*.xml
18+
/vendor/**/*.dist
19+
/vendor/**/readme.php
20+
/vendor/**/LICENSE
21+
/vendor/**/COPYING
22+
/vendor/**/VERSION
23+
/vendor/**/docs/*
24+
/vendor/**/example/*
25+
/vendor/**/examples/*
26+
/vendor/**/test/*
27+
/vendor/**/tests/*
28+
/vendor/**/php4/*
29+
/vendor/getkirby/composer-installer

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Kirby 3 disable Google's FLoC
2+
3+
This plugin for [Kirby 3](https://getkirby.com) disables Google's FLoC automatically.
4+
5+
## Requirements
6+
7+
- PHP 7.3+
8+
- Kirby 3
9+
10+
## Installation
11+
12+
### Download
13+
14+
[Download](https://github.com/MRFD/kirby-disable-floc/archive/master.zip) and copy the files to `/site/plugins/kirby-disable-floc`.
15+
16+
### Git submodule
17+
18+
```bash
19+
$ git submodule add https://github.com/MRFD/kirby-disable-floc.git site/plugins/kirby-disable-floc
20+
```
21+
22+
### Composer
23+
24+
```bash
25+
composer require MRFD/kirby-disable-floc
26+
```
27+
28+
## Usage
29+
30+
After installing this plugin, the `Permissions-Policy` header is automatically added to every route by utilising Kirby's `route:before` hook. This ensures that FLoC is disabled.
31+
32+
### Options
33+
34+
| mrfd.kirby-disable-floc. | Default | Description |
35+
| ------------------------ | ------- | ---------------------------------------------- |
36+
| enable | `true` | enables or disables the plugin |
37+
| replace | `true` | replacing existing `Permissions-Policy` header |
38+
39+
## Disclaimer
40+
41+
This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please [create a new issue](https://github.com/MRFD/kirby-disable-floc/issues/new).
42+
43+
## License
44+
45+
Kirby Disable FLoC is open-sourced software licensed under the [MIT](https://opensource.org/licenses/MIT) license.
46+
47+
Copyright © 2021 [Marijn Roovers](https://www.mrfd.nl)
48+
49+
## Credits
50+
51+
- [Spatie's Laravel implementation](https://github.com/spatie/laravel-disable-floc/)

composer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "mrfd/kirby-disable-floc",
3+
"description": "Automatically disable Google's floc in Kirby 3",
4+
"type": "kirby-plugin",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Marijn Roovers",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"keywords": [
13+
"kirby3",
14+
"kirby3-cms",
15+
"kirby3-plugin"
16+
],
17+
"require": {
18+
"php": "^7.3|^7.4|^8.0",
19+
"getkirby/composer-installer": "^1.1"
20+
},
21+
"config": {
22+
"optimize-autoloader": true
23+
}
24+
}

index.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/**
4+
* Kirby 3 Disable FLoC
5+
*
6+
* @version 0.0.1
7+
* @author Marijn Roovers <[email protected]>
8+
* @copyright Marijn Roovers <[email protected]>
9+
* @link https://github.com/mrfd/kirby-disable-floc
10+
* @license MIT
11+
*/
12+
13+
Kirby::plugin('mrfd/kirby-disable-floc', [
14+
'hooks' => [
15+
'route:before' => function () {
16+
$options = option('mrfd.kirby-disable-floc');
17+
18+
if ($options['enable'] === true) {
19+
header(
20+
'Permissions-Policy: interest-cohort=()',
21+
$options['replace']
22+
);
23+
}
24+
}
25+
],
26+
'options' => [
27+
'enable' => true,
28+
'replace' => true,
29+
]
30+
]);

0 commit comments

Comments
 (0)