7 Commits

Author SHA1 Message Date
Gitea Actions
d1492c4c1a Update manifest version to 2.0.2 [▶️] 2026-01-03 16:05:57 +00:00
080e0a43c4 Update plugin.php
All checks were successful
Build, Push, Publish / Build & Release (push) Successful in 21s
2026-01-03 16:05:46 +00:00
Gitea Actions
fe368569a7 Update manifest version to 2.0.1 [▶️] 2026-01-03 01:41:31 +00:00
276fac6409 Update plugin.php
All checks were successful
Build, Push, Publish / Build & Release (push) Successful in 22s
2026-01-03 01:41:19 +00:00
20751b5052 Update manifest.json
All checks were successful
Build, Push, Publish / Build & Release (push) Successful in 9s
2026-01-03 01:37:54 +00:00
Gitea Actions
16e8ecf708 Update manifest version to 1.4.2 [▶️] 2026-01-03 01:37:35 +00:00
7014a64e31 Update plugin.php
All checks were successful
Build, Push, Publish / Build & Release (push) Successful in 21s
2026-01-03 01:37:23 +00:00
2 changed files with 118 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
{ {
"version": "1.4.1", "version": "2.0.2",
"author": "Ivan Carlos" "author": "Ivan Carlos"
} }

View File

@@ -1,9 +1,9 @@
<?php <?php
/* /*
Plugin Name: ICC Webmaster Settings Plugin Name: ICC Webmaster Settings
Plugin URI: https://github.com/ivancarlosti/yourlsiccwebmastersettings Plugin URI: https://git.icc.gg/ivancarlos/yourlsiccwebmastersettings
Description: Customize Logo, Title, Footer, CSS & Favicons. Add reCAPTCHA v3, Meta Redirects (delayed), and Force 302 Redirects. Description: Customize Logo, Title, Footer, CSS & Favicons. Add reCAPTCHA v3, HTTP Redirect, 301/302 Redirects, Dash/Underscore, Force Lowercase & Share features.
Version: 2.0 Version: 2.3
Author: Ivan Carlos Author: Ivan Carlos
Author URI: https://ivancarlos.com.br/ Author URI: https://ivancarlos.com.br/
*/ */
@@ -78,10 +78,24 @@ function icc_config_do_page()
} }
$escaped_delay = (int) $icc_mrdr_delay; $escaped_delay = (int) $icc_mrdr_delay;
// 302 Redirect options
$icc_302_redirect_enabled = yourls_get_option('icc_302_redirect_enabled');
// 302 Redirect options // 302 Redirect options
$icc_302_redirect_enabled = yourls_get_option('icc_302_redirect_enabled'); $icc_302_redirect_enabled = yourls_get_option('icc_302_redirect_enabled');
$redirect_302_checked = $icc_302_redirect_enabled ? 'checked' : ''; $redirect_302_checked = $icc_302_redirect_enabled ? 'checked' : '';
// Remove Share options
$icc_remove_share_enabled = yourls_get_option('icc_remove_share_enabled');
$remove_share_checked = $icc_remove_share_enabled ? 'checked' : '';
// Allow Dash/Underscore options
$icc_allow_dash_underscore_enabled = yourls_get_option('icc_allow_dash_underscore_enabled');
$allow_dash_underscore_checked = $icc_allow_dash_underscore_enabled ? 'checked' : '';
// Force Lowercase options
$icc_force_lowercase_enabled = yourls_get_option('icc_force_lowercase_enabled');
$force_lowercase_checked = $icc_force_lowercase_enabled ? 'checked' : '';
echo <<<HTML echo <<<HTML
<h2>Webmaster Settings</h2> <h2>Webmaster Settings</h2>
<form method="post"> <form method="post">
@@ -143,12 +157,29 @@ function icc_config_do_page()
<br><span style="padding-left: 205px;"><small>Use 302 (Temporary) instead of 301 (Permanent) for standard redirects.</small></span> <br><span style="padding-left: 205px;"><small>Use 302 (Temporary) instead of 301 (Permanent) for standard redirects.</small></span>
</p> </p>
<h3>Interface Settings</h3>
<p>
<label for="icc_remove_share_enabled" style="display: inline-block; width: 200px;">Remove Share Button</label>
<input type="checkbox" id="icc_remove_share_enabled" name="icc_remove_share_enabled" value="1" {$remove_share_checked} />
<br><span style="padding-left: 205px;"><small>Remove the Share button and box from the Admin Dashboard.</small></span>
</p>
<p>
<label for="icc_allow_dash_underscore_enabled" style="display: inline-block; width: 200px;">Allow Dash & Underscore</label>
<input type="checkbox" id="icc_allow_dash_underscore_enabled" name="icc_allow_dash_underscore_enabled" value="1" {$allow_dash_underscore_checked} />
<br><span style="padding-left: 205px;"><small>Allow dashes (-) and underscores (_) in custom short URLs.</small></span>
</p>
<p>
<label for="icc_force_lowercase_enabled" style="display: inline-block; width: 200px;">Force Lowercase</label>
<input type="checkbox" id="icc_force_lowercase_enabled" name="icc_force_lowercase_enabled" value="1" {$force_lowercase_checked} />
<br><span style="padding-left: 205px;"><small>Force uppercase keywords to be converted to lowercase (e.g., ABC -> abc).</small></span>
</p>
<p><input type="submit" name="icc_submit" value="Update values" /></p> <p><input type="submit" name="icc_submit" value="Update values" /></p>
</form> </form>
<hr style="margin-top: 40px" /> <hr style="margin-top: 40px" />
<p><strong><a href="https://ivancarlos.me/" target="_blank">Ivan Carlos</a></strong> &raquo; <p><strong><a href="https://ivancarlos.me/" target="_blank">Ivan Carlos</a></strong> &raquo;
<a href="http://github.com/ivancarlosti/" target="_blank">GitHub</a> &raquo; <a href="https://buymeacoffee.com/ivancarlos" target="_blank">Buy Me a Coffee</a> &raquo;
<a href="https://buymeacoffee.com/ivancarlos" target="_blank">Buy Me a Coffee</a></p> <a href="https://patreon.com/ivancarlos" target="_blank">Patreon</a></p>
HTML; HTML;
} }
@@ -205,6 +236,20 @@ function icc_config_update_option()
// 302 Redirect update // 302 Redirect update
$redirect_302_enabled = isset($_POST['icc_302_redirect_enabled']); $redirect_302_enabled = isset($_POST['icc_302_redirect_enabled']);
yourls_update_option('icc_302_redirect_enabled', $redirect_302_enabled); yourls_update_option('icc_302_redirect_enabled', $redirect_302_enabled);
$redirect_302_enabled = isset($_POST['icc_302_redirect_enabled']);
yourls_update_option('icc_302_redirect_enabled', $redirect_302_enabled);
// Remove Share update
$remove_share_enabled = isset($_POST['icc_remove_share_enabled']);
yourls_update_option('icc_remove_share_enabled', $remove_share_enabled);
// Allow Dash/Underscore update
$allow_dash_underscore_enabled = isset($_POST['icc_allow_dash_underscore_enabled']);
yourls_update_option('icc_allow_dash_underscore_enabled', $allow_dash_underscore_enabled);
// Force Lowercase update
$force_lowercase_enabled = isset($_POST['icc_force_lowercase_enabled']);
yourls_update_option('icc_force_lowercase_enabled', $force_lowercase_enabled);
} }
// Show custom logo // Show custom logo
@@ -276,10 +321,12 @@ function icc_print_custom_css()
// reCAPTCHA v3 Integration // reCAPTCHA v3 Integration
yourls_add_action('html_head', 'icc_recaptcha_v3_html_head'); yourls_add_action('html_head', 'icc_recaptcha_v3_html_head');
function icc_recaptcha_v3_html_head() function icc_recaptcha_v3_html_head()
{ {
if (!yourls_get_option('icc_recaptcha_enabled')) if (!yourls_get_option('icc_recaptcha_enabled'))
return; return;
$site_key = yourls_get_option('icc_recaptcha_site_key'); $site_key = yourls_get_option('icc_recaptcha_site_key');
if ($site_key) { if ($site_key) {
echo '<script src="https://www.google.com/recaptcha/api.js?render=' . htmlspecialchars($site_key, ENT_QUOTES) . '"></script>'; echo '<script src="https://www.google.com/recaptcha/api.js?render=' . htmlspecialchars($site_key, ENT_QUOTES) . '"></script>';
@@ -403,3 +450,68 @@ function icc_force_302_redirect($args)
die(); die();
} }
} }
// Allow dash and underscore in custom short URLs
if (yourls_get_option('icc_allow_dash_underscore_enabled')) {
yourls_add_filter('get_shorturl_charset', 'icc_custom_shorturl_charset');
yourls_add_filter('get_shorturl_charset_regex', 'icc_custom_shorturl_charset_regex');
}
function icc_custom_shorturl_charset($charset)
{
return $charset . '-_';
}
function icc_custom_shorturl_charset_regex($pattern)
{
return $pattern . '|[-_]';
}
// Force Lowercase Logic
if (yourls_get_option('icc_force_lowercase_enabled')) {
// Redirection: http://sho.rt/ABC first converted to http://sho.rt/abc
yourls_add_filter('get_request', 'icc_break_the_web_lowercase');
// Short URL creation: custom keyword 'ABC' converted to 'abc'
yourls_add_action('add_new_link_custom_keyword', 'icc_break_the_web_add_filter');
// Force random keywords to be lowercase
yourls_add_filter('random_keyword', 'icc_break_the_web_lowercase');
}
function icc_break_the_web_lowercase($keyword)
{
return strtolower($keyword);
}
function icc_break_the_web_add_filter()
{
yourls_add_filter('get_shorturl_charset', 'icc_break_the_web_add_uppercase');
yourls_add_filter('custom_keyword', 'icc_break_the_web_lowercase');
}
function icc_break_the_web_add_uppercase($charset)
{
return $charset . strtoupper($charset);
}
// Remove Share Functionality
if (yourls_get_option('icc_remove_share_enabled')) {
// Dump the Share button
yourls_add_filter('table_add_row_action_array', 'icc_rmv_row_action_share');
// No Share Box either
yourls_add_filter('shunt_share_box', 'icc_shunt_share_box');
}
function icc_rmv_row_action_share($links)
{
if (array_key_exists('share', $links))
unset($links['share']);
return $links;
}
function icc_shunt_share_box($shunt)
{
return true;
}