Auto Shortening URLs

This commit is contained in:
Karthik Kasturi 2025-08-09 00:01:25 +01:00
parent 08c44cfb05
commit 059e64adb1
7 changed files with 43 additions and 2 deletions

View file

@ -565,12 +565,20 @@ endif;
if (!empty($URLSHORTENER)) :
?>
<p>
<button id="shortenbutton" data-shortener="<?php echo I18n::encode($URLSHORTENER); ?>" type="button" class="btn btn-<?php echo $isDark ? 'warning' : 'primary'; ?> btn-block">
<button id="shortenbutton" data-shortener="<?php echo I18n::encode($URLSHORTENER); ?>"
<?php if ($SHORTENBYDEFAULT) : ?>
data-autoshorten="true"
<?php endif; ?>
type="button" class="btn btn-<?php echo $isDark ? 'warning' : 'primary'; ?> btn-block"
>
<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button>
</p>
<div role="alert" class="alert alert-danger">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<?php if ($SHORTENBYDEFAULT) : ?>
<?php echo I18n::_('URL shortener is enabled by default.'), PHP_EOL; ?>
<?php endif; ?>
<?php echo I18n::_('URL shortener may expose your decrypt key in URL.'), PHP_EOL; ?>
</div>
<?php

View file

@ -432,12 +432,20 @@ endif;
if (!empty($URLSHORTENER)) :
?>
<p>
<button id="shortenbutton" data-shortener="<?php echo I18n::encode($URLSHORTENER); ?>" type="button" class="btn btn-primary btn-block d-flex justify-content-center align-items-center gap-1">
<button id="shortenbutton" data-shortener="<?php echo I18n::encode($URLSHORTENER); ?>"
<?php if ($SHORTENBYDEFAULT) : ?>
data-autoshorten="true"
<?php endif; ?>
type="button" class="btn btn-primary btn-block d-flex justify-content-center align-items-center gap-1"
>
<svg width="16" height="16" fill="currentColor" aria-hidden="true"><use href="img/bootstrap-icons.svg#send" /></svg> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button>
</p>
<div role="alert" class="alert alert-danger">
<svg width="16" height="16" fill="currentColor" aria-hidden="true"><use href="img/bootstrap-icons.svg#exclamation-circle" /></svg>
<?php if ($SHORTENBYDEFAULT) : ?>
<?php echo I18n::_('URL shortener is enabled by default.'), PHP_EOL; ?>
<?php endif; ?>
<?php echo I18n::_('URL shortener may expose your decrypt key in URL.'), PHP_EOL; ?>
</div>
<?php