Skip to content

Commit

Permalink
Undo fingerprint for content files - use K3 included hashes instead!
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Vandeputte committed Mar 12, 2019
1 parent aaf6e5a commit 040a799
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
14 changes: 0 additions & 14 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

require __DIR__ . DS . "src" . DS . "Fingerprint.php";

Kirby::plugin('bvdputte/fingerprint', [
'fileMethods' => [
'fingerprint' => function () {
return bvdputte\Fingerprint::addHash($this->root());
}
]
]);

/*
A little Kirby helper functions
*/
Expand All @@ -24,10 +16,4 @@ function jsfingerprint($url, $options = null)
{
return bvdputte\Fingerprint::js($url, $options = null);
}
}
if (! function_exists("fingerprint")) {
function fingerprint($path)
{
return bvdputte\Fingerprint::addHash($path);
}
}
11 changes: 0 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ jsfingerprint("assets/scripts.js");
// Output: <script src="//localhost:3000/assets/js/scripts.1e9dd0c95e7b12ce96729501c7585deb.js"></script>
```

You can also use this on a `path` or `$file` objects:

```php
echo fingerprint($page->some_imagefield()->toFile()->root());
// Output: /var/www/mysite/content/home/testimage.0d859e73e897635c53e59407be9b32aa.jpg
echo $page->some_imagefield()->toFile()->fingerprint();
// Output: /var/www/mysite/content/home/testimage.0d859e73e897635c53e59407be9b32aa.jpg
```

💡 Always test if the file exists first!

## Advanced features

For more advanced features, such as subresource integrity, please checkout [bnomei's kirby3-fingerprint plugin](https://github.com/bnomei/kirby3-fingerprint).
Expand Down

0 comments on commit 040a799

Please sign in to comment.