Initial commit

This commit is contained in:
isUnknown 2026-02-12 15:22:46 +01:00
commit 65e0da7e11
1397 changed files with 596542 additions and 0 deletions

View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2018
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,28 @@
# Kirby Autobuster Plugin
This plugin is based on the original Cachebuster by Bastian Allgeier, the modified version by Lukas Kleinschmidt with further modifications & enhancemnets by Sonja Broda & James Steel.
Original plugin did not cache bust autoloaded Javascript or CSS. This plugin does.
## Features
* No longer requires modifications to server configuration files
* Will cache bust auto loaded CSS & JavaScript
## Requirements
This plugin requires Kirby 2.4+
## Installation
To use this plugin, place all the files in `site/plugins/autobuster`.
Now you can activate the plugin with following line in your `config.php`.
```
c::set('autobuster', true);
```
## Authors
Bastian Allgeier, Lukas Bestle, Lukas Kleinschmidt, Sonja Broda & James Steel

View file

@ -0,0 +1,11 @@
<?php
if(!c::get('autobuster')) return;
load([
'kirby\\autobuster\\css' => __DIR__ . DS . 'lib' . DS . 'css.php',
'kirby\\autobuster\\js' => __DIR__ . DS . 'lib' . DS . 'js.php'
]);
kirby()->set('component', 'css', 'Kirby\\Autobuster\\CSS');
kirby()->set('component', 'js', 'Kirby\\Autobuster\\JS');

View file

@ -0,0 +1,58 @@
<?php
namespace Kirby\Autobuster;
use F;
/**
* Kirby Autobuster CSS Component
*
* @package Kirby CMS
* @author Bastian Allgeier <bastian@getkirby.com>
* @link http://getkirby.com
* @copyright Bastian Allgeier
* @license http://getkirby.com/license
*/
class CSS extends \Kirby\Component\CSS {
/**
* Builds the html link tag for the given css file
*
* @param string $url
* @param null|string $media
* @return string
*/
public function tag($url, $media = null) {
if(is_array($url)) {
$css = array();
foreach($url as $u) $css[] = $this->tag($u, $media);
return implode(PHP_EOL, $css) . PHP_EOL;
}
// auto template css files
if ($url == '@auto') {
$template = $this->kirby->site()->page()->template();
$file = $template . '.css';
$root = $this->kirby->roots()->autocss() . DS . $file;
if (file_exists($root)) {
$mod = f::modified($root);
$url = $this->kirby->urls()->autocss() . '/' . $template . '.css' . '?v=' . $mod;
} else {
return false;
}
} else {
$file = kirby()->roots()->index() . DS . $url;
if (file_exists($file)) {
$mod = f::modified($file);
$url = dirname($url) . '/' . f::filename($url) . '?v=' . $mod;
}
}
return parent::tag($url, $media);
}
}

View file

@ -0,0 +1,66 @@
<?php
namespace Kirby\Autobuster;
use HTML;
use STR;
use F;
/**
* Kirby Autobuster JS Component
*
* @package Kirby CMS
* @author Bastian Allgeier <bastian@getkirby.com>
* @link http://getkirby.com
* @copyright Bastian Allgeier
* @license http://getkirby.com/license
*/
class JS extends \Kirby\Component\JS
{
/**
* Builds the html script tag for the given javascript file
*
* @param string $src
* @param boolean async
* @return string
*/
public function tag($src, $async = false)
{
if (is_array($src)) {
$js = array();
foreach ($src as $s) {
$js[] = $this->tag($s, $async);
}
return implode(PHP_EOL, $js) . PHP_EOL;
}
// auto template js files
if ($src == '@auto') {
$template = $this->kirby->site()->page()->template();
$file = $template . '.js';
$root = $this->kirby->roots()->autojs() . DS . $file;
if (file_exists($root)) {
$mod = f::modified($root);
$src = $this->kirby->urls()->autojs() . '/' . $template . '.js' . '?v=' . $mod;
} else {
return false;
}
} else {
$file = kirby()->roots()->index() . DS . $src;
if (file_exists($file)) {
$mod = f::modified($file);
$src = dirname($src) . '/' . f::filename($src) . '?v=' . $mod;
}
}
// build the array of HTML attributes
$attr = array('src' => url($src));
if (is_array($async)) {
$attr = array_merge($attr, $async);
} elseif ($async === true) {
$attr['async'] = true;
}
return html::tag('script', '', $attr);
}
}

View file

@ -0,0 +1,18 @@
{
"name": "autobuster",
"description": "Kirby Autobuster Plugin",
"version": "2.2.0",
"type": "kirby-plugin",
"contributors": [
"Bastian Allgeier <bastian@getkirby.com> (https://getkirby.com)",
"Lukas Bestle <lukas@getkirby.com> (https://getkirby.com)",
"Sonja Broda <sonja@getkirby.com> (https://getkirby.com)",
"Lukas Kleinschmidt (https://github.com/lukaskleinschmidt)",
"James Steel <hello@hashandsalt.com> (https://hashandsalt.com)"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/HashandSalt/autobuster"
}
}