You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
689 B
PHP
30 lines
689 B
PHP
<?php
|
|
|
|
use Kirby\Http\Url;
|
|
use Kirby\Toolkit\F;
|
|
|
|
Kirby::plugin('lukasbestle/qdated', [
|
|
'tags' => [
|
|
'qdated' => [
|
|
'html' => function($tag) {
|
|
$qdated = qdated($tag->qdated);
|
|
return '<a href="mailto:' . $qdated . '">' . $qdated . '</a>';
|
|
}
|
|
]
|
|
]
|
|
]);
|
|
|
|
/**
|
|
* Returns the current qdated address
|
|
* If qdated is not available, returns null
|
|
*
|
|
* @param string $destination
|
|
* @return string
|
|
*/
|
|
function qdated(string $destination) {
|
|
$path = $_SERVER['HOME'] . '/.config/qdated/' . $destination . '/current';
|
|
if(!is_file($path)) return null;
|
|
|
|
return 'dated-' . trim(F::read($path)) . '@' . Url::host();
|
|
}
|