From 1e76956efd6a7865157ecb0cbcfc014e6930ba37 Mon Sep 17 00:00:00 2001 From: ozhozh Date: Fri, 25 Jun 2010 12:53:15 +0000 Subject: [PATCH] Revert to a-zA-Z0-9 charset in short url keywords, but bundle a core plugin allowing hyphens. Fixes issue 80. Fixes issue 103. Fixes issue 292. git-svn-id: http://yourls.googlecode.com/svn/trunk@412 12232710-3e20-11de-b438-597f59cd7555 --- includes/functions.php | 6 +++--- user/plugins/hyphens-in-urls/README.txt | 4 ++++ user/plugins/hyphens-in-urls/plugin.php | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 user/plugins/hyphens-in-urls/README.txt create mode 100644 user/plugins/hyphens-in-urls/plugin.php diff --git a/includes/functions.php b/includes/functions.php index 84c2198..d707575 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -11,15 +11,15 @@ function yourls_get_shorturl_charset() { return $charset; if( !defined('YOURLS_URL_CONVERT') ) { - $charset = '0123456789abcdefghijklmnopqrstuvwxyz-'; + $charset = '0123456789abcdefghijklmnopqrstuvwxyz'; } else { switch( YOURLS_URL_CONVERT ) { case 36: - $charset = '0123456789abcdefghijklmnopqrstuvwxyz-'; + $charset = '0123456789abcdefghijklmnopqrstuvwxyz'; break; case 62: case 64: // just because some people get this wrong in their config.php - $charset = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-'; + $charset = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; break; } } diff --git a/user/plugins/hyphens-in-urls/README.txt b/user/plugins/hyphens-in-urls/README.txt new file mode 100644 index 0000000..54f1425 --- /dev/null +++ b/user/plugins/hyphens-in-urls/README.txt @@ -0,0 +1,4 @@ +This is a core plugin, bundled with YOURLS. +Don't modify this plugin. Instead, copy its folder +and modify your own copy. This way, your code won't +be overwritten when you upgrade YOURLS. \ No newline at end of file diff --git a/user/plugins/hyphens-in-urls/plugin.php b/user/plugins/hyphens-in-urls/plugin.php new file mode 100644 index 0000000..a9bacb0 --- /dev/null +++ b/user/plugins/hyphens-in-urls/plugin.php @@ -0,0 +1,17 @@ +http://sho.rt/hello-world) +Version: 1.0 +Author: Ozh +Author URI: http://ozh.org/ +*/ + +yourls_add_filter( 'get_shorturl_charset', 'ozh_hyphen_in_charset' ); +function ozh_hyphen_in_charset( $in ) { + return $in.'-'; +} + + +?> \ No newline at end of file -- 2.45.0