1
0
Fork 0

Switch to new dated email format

master
Lukas Bestle 5 years ago
parent 5c2a9e6c7c
commit 03feda7baf
Signed by: lukas
GPG Key ID: 692037D104550FC9

@ -16,7 +16,7 @@ DE 300 983 590
### Contact ### Contact
(qdated: cddmail1) (dated:)
<small>(link: pgp.asc text: PGP: D703 9FD2 4AAE 69E9 97A6  92FF 2E2A DD32 FE50 61C1 rel: pgpkey)</small> <small>(link: pgp.asc text: PGP: D703 9FD2 4AAE 69E9 97A6  92FF 2E2A DD32 FE50 61C1 rel: pgpkey)</small>
This email address is valid for one week, after which it expires. Emails to this address are received by me personally and are responded to as fast as possible. Together with my reply, you will get my permanently valid email address. This email address is valid for one week, after which it expires. Emails to this address are received by me personally and are responded to as fast as possible. Together with my reply, you will get my permanently valid email address.

@ -0,0 +1,46 @@
<?php
use Kirby\Http\Url;
use Kirby\Toolkit\F;
Kirby::plugin('lukasbestle/dated', [
'tags' => [
'dated' => [
'html' => function($tag) {
$dated = dated();
return '<a href="mailto:' . $dated . '">' . $dated . '</a>';
}
]
]
]);
/**
* Returns the current dated address
*
* @return string
*/
function dated(): string {
// date in seven days
$date = modifiedJulianDate(time() + 7 * 24 * 60 * 60);
return 'dated-' . $date . '@' . Url::host();
}
/**
* Returns the Modified Julian Date,
* which is the Julian Date with the first two digits stripped
* and with an offset of one day to compensate for the Julian Date
* starting at noon instead of at midnight
*
* @param int $timestamp Timestamp to calculate from, defaults to the current date
* @return int
*/
function modifiedJulianDate(?int $timestamp = null): int {
$timestamp = $timestamp ?? time();
return gregoriantojd(
date('m', $timestamp),
date('d', $timestamp),
date('Y', $timestamp)
) - 2400001;
}

@ -1,29 +0,0 @@
<?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();
}

@ -28,7 +28,7 @@
<span>code designer</span> <span>code designer</span>
<div class="header__links"> <div class="header__links">
<a href="mailto:<?= qdated('cddmail1') ?>" title="Email" rel="me"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#043788" d="M256 0C114.615 0 0 114.615 0 256s114.615 256 256 256 256-114.615 256-256S397.385 0 256 0zM128 128h256c4.569 0 9.002.981 13.072 2.831L256 295.415 114.928 130.83A31.548 31.548 0 0 1 128 128zM96 352V160c0-.67.028-1.336.07-2l93.832 109.471-92.799 92.799A31.634 31.634 0 0 1 96 352zm288 32H128c-2.827 0-5.601-.381-8.27-1.104l91.059-91.059L256 344.586l45.212-52.747 91.058 91.06A31.729 31.729 0 0 1 384 384zm32-32c0 2.827-.381 5.6-1.103 8.27l-92.8-92.799L415.93 158c.042.664.07 1.33.07 2v192z"/></svg></a> <a href="mailto:<?= dated() ?>" title="Email" rel="me"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#043788" d="M256 0C114.615 0 0 114.615 0 256s114.615 256 256 256 256-114.615 256-256S397.385 0 256 0zM128 128h256c4.569 0 9.002.981 13.072 2.831L256 295.415 114.928 130.83A31.548 31.548 0 0 1 128 128zM96 352V160c0-.67.028-1.336.07-2l93.832 109.471-92.799 92.799A31.634 31.634 0 0 1 96 352zm288 32H128c-2.827 0-5.601-.381-8.27-1.104l91.059-91.059L256 344.586l45.212-52.747 91.058 91.06A31.729 31.729 0 0 1 384 384zm32-32c0 2.827-.381 5.6-1.103 8.27l-92.8-92.799L415.93 158c.042.664.07 1.33.07 2v192z"/></svg></a>
<a href="https://github.com/lukasbestle" title="GitHub" rel="me"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#043788" d="M256.004 6.321C114.635 6.321 0 120.93 0 262.32c0 113.107 73.352 209.066 175.068 242.918 12.793 2.369 17.496-5.555 17.496-12.316 0-6.102-.24-26.271-.348-47.662-71.224 15.488-86.252-30.205-86.252-30.205-11.641-29.588-28.424-37.458-28.424-37.458-23.226-15.889 1.755-15.562 1.755-15.562 25.7 1.805 39.238 26.383 39.238 26.383 22.836 39.135 59.888 27.82 74.502 21.279 2.294-16.543 8.926-27.84 16.253-34.232C152.423 368.994 92.65 347.04 92.65 248.949c0-27.949 10.002-50.787 26.38-68.714-2.658-6.45-11.427-32.486 2.476-67.75 0 0 21.503-6.876 70.42 26.245 20.418-5.674 42.318-8.518 64.077-8.617 21.751.099 43.668 2.943 64.128 8.617 48.867-33.122 70.328-26.245 70.328-26.245 13.936 35.264 5.175 61.3 2.518 67.75 16.41 17.928 26.347 40.766 26.347 68.714 0 98.327-59.889 119.975-116.895 126.312 9.182 7.945 17.362 23.523 17.362 47.406 0 34.254-.298 61.822-.298 70.254 0 6.814 4.611 14.797 17.586 12.283C438.74 471.316 512 375.391 512 262.32 512 120.93 397.383 6.321 256.004 6.321z"/></svg></a> <a href="https://github.com/lukasbestle" title="GitHub" rel="me"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#043788" d="M256.004 6.321C114.635 6.321 0 120.93 0 262.32c0 113.107 73.352 209.066 175.068 242.918 12.793 2.369 17.496-5.555 17.496-12.316 0-6.102-.24-26.271-.348-47.662-71.224 15.488-86.252-30.205-86.252-30.205-11.641-29.588-28.424-37.458-28.424-37.458-23.226-15.889 1.755-15.562 1.755-15.562 25.7 1.805 39.238 26.383 39.238 26.383 22.836 39.135 59.888 27.82 74.502 21.279 2.294-16.543 8.926-27.84 16.253-34.232C152.423 368.994 92.65 347.04 92.65 248.949c0-27.949 10.002-50.787 26.38-68.714-2.658-6.45-11.427-32.486 2.476-67.75 0 0 21.503-6.876 70.42 26.245 20.418-5.674 42.318-8.518 64.077-8.617 21.751.099 43.668 2.943 64.128 8.617 48.867-33.122 70.328-26.245 70.328-26.245 13.936 35.264 5.175 61.3 2.518 67.75 16.41 17.928 26.347 40.766 26.347 68.714 0 98.327-59.889 119.975-116.895 126.312 9.182 7.945 17.362 23.523 17.362 47.406 0 34.254-.298 61.822-.298 70.254 0 6.814 4.611 14.797 17.586 12.283C438.74 471.316 512 375.391 512 262.32 512 120.93 397.383 6.321 256.004 6.321z"/></svg></a>
<a href="https://twitter.com/lukasbestle" title="Twitter" rel="me"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#043788" d="M512 113.2c-18.8 8.4-39.1 14-60.3 16.5 21.7-13 38.3-33.6 46.2-58.1-20.3 12-42.8 20.8-66.7 25.5C412 76.7 384.7 64 354.5 64c-58 0-105 47-105 105 0 8.2.9 16.2 2.7 23.9-87.3-4.4-164.7-46.2-216.5-109.8-9 15.5-14.2 33.6-14.2 52.8 0 36.4 18.5 68.6 46.7 87.4-17.2-.5-33.4-5.3-47.6-13.1v1.3c0 50.9 36.2 93.4 84.3 103-8.8 2.4-18.1 3.7-27.7 3.7-6.8 0-13.3-.7-19.8-1.9 13.4 41.7 52.2 72.1 98.1 73-36 28.2-81.2 45-130.5 45-8.5 0-16.8-.5-25.1-1.5C46.5 462.7 101.7 480 161 480c193.2 0 298.9-160.1 298.9-298.9 0-4.6-.1-9.1-.3-13.6 20.5-14.7 38.3-33.2 52.4-54.3z"/></svg></a> <a href="https://twitter.com/lukasbestle" title="Twitter" rel="me"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#043788" d="M512 113.2c-18.8 8.4-39.1 14-60.3 16.5 21.7-13 38.3-33.6 46.2-58.1-20.3 12-42.8 20.8-66.7 25.5C412 76.7 384.7 64 354.5 64c-58 0-105 47-105 105 0 8.2.9 16.2 2.7 23.9-87.3-4.4-164.7-46.2-216.5-109.8-9 15.5-14.2 33.6-14.2 52.8 0 36.4 18.5 68.6 46.7 87.4-17.2-.5-33.4-5.3-47.6-13.1v1.3c0 50.9 36.2 93.4 84.3 103-8.8 2.4-18.1 3.7-27.7 3.7-6.8 0-13.3-.7-19.8-1.9 13.4 41.7 52.2 72.1 98.1 73-36 28.2-81.2 45-130.5 45-8.5 0-16.8-.5-25.1-1.5C46.5 462.7 101.7 480 161 480c193.2 0 298.9-160.1 298.9-298.9 0-4.6-.1-9.1-.3-13.6 20.5-14.7 38.3-33.2 52.4-54.3z"/></svg></a>
</div> </div>

Loading…
Cancel
Save