Initial public commit

This commit is contained in:
2016-08-15 18:47:13 +02:00
commit bbc99c6967
67 changed files with 1517 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* Returns the current qdated address
* If qdated is not available, returns null
*
* @return string
*/
function qdated() {
$path = $_SERVER['HOME'] . DS . '.qdated-current';
if(!is_file($path)) return null;
return 'dated-' . trim(f::read($path)) . '@' . url::host();
}
/**
* Returns an HTML a mailto tag with the current qdated address
* If qdated is not available, returns an HTML error message
*
* @param mixed $text Optional text for the link
* Can also be true to use the email
* address but put a line break in it
* @return string HTML code
*/
function qdatedHtml($text = false) {
$email = qdated();
if(!$email) return '<p><strong>' . l::get('qdated.error') . '</strong></p>';
if($text === true) $text = str_replace('@', '<br>@', $email);
return str::email($email, $text);
}
/**
* qdated Kirbytag
*
* Usage: (qdated: Optional link text)
*/
kirby()->set('tag', 'qdated', [
'html' => function($tag) {
return qdatedHtml($tag->attr('qdated'));
}
]);