mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
feat: clarification contact étudiant + déplacer Contact visible dans Informations du TFE
- Label : « Contact visible (optionnel) », placeholder : mail/site/insta/etc. - Hint : demander l'URL complète, le système raccourcit à l'affichage - Affichage public (tfe.php) : extraction d'identifiant depuis l'URL - Déplacement de contact_visible du Backoffice vers le fieldset Informations du TFE - Renommage « Identité » → « Informations du TFE » dans le récapitulatif admin
This commit is contained in:
@@ -195,13 +195,13 @@
|
||||
<span class="tfe-meta-label">Contact :</span>
|
||||
<?php
|
||||
$_contact = $data["contact_visible"];
|
||||
$_isUrl = filter_var($_contact, FILTER_VALIDATE_URL) !== false;
|
||||
$_isEmail = !$_isUrl && str_contains($_contact, "@");
|
||||
$_isUrl = filter_var($_contact, FILTER_VALIDATE_URL) !== false;
|
||||
$_isEmail = !$_isUrl && str_contains($_contact, '@') && !str_starts_with($_contact, '@');
|
||||
if ($_isUrl):
|
||||
$_host = parse_url($_contact, PHP_URL_HOST);
|
||||
$_path = parse_url($_contact, PHP_URL_PATH) ?? '';
|
||||
$_isInstagram = $_host && str_contains($_host, 'instagram.com');
|
||||
$_isMastodon = $_path && str_contains($_path, '/@');
|
||||
$_isMastodon = $_path && str_contains($_path, '/@');
|
||||
if ($_isInstagram):
|
||||
$_username = trim($_path, '/');
|
||||
$_display = $_username ? '@' . $_username : preg_replace("#^https?://(www\.)?#i", "", rtrim($_contact, "/"));
|
||||
@@ -217,8 +217,17 @@
|
||||
</a>
|
||||
<?php elseif ($_isEmail): ?>
|
||||
<a href="<?= EmailObfuscator::mailto($_contact) ?>"><?= htmlspecialchars($_contact) ?></a>
|
||||
<?php else: ?>
|
||||
<?php else:
|
||||
// Bare domain (ex: erg.be) or unrecognised → try to link it
|
||||
$_looksLikeDomain = !str_contains($_contact, ' ') && preg_match('#\.[a-z]{2,}$#i', $_contact);
|
||||
if ($_looksLikeDomain): ?>
|
||||
<a href="https://<?= htmlspecialchars($_contact) ?>" target="_blank" rel="noopener">
|
||||
<?= htmlspecialchars($_contact) ?>
|
||||
<span class="sr-only">(ouvre dans un nouvel onglet)</span>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<?= htmlspecialchars($_contact) ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user