Fixed Broken Shit
This commit is contained in:
37
user/plugins/force-lowercase/plugin.php
Normal file
37
user/plugins/force-lowercase/plugin.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Force Lowercase
|
||||
Plugin URI: http://yourls.org/
|
||||
Description: Force lowercase so http://sho.rt/ABC == http://sho.rt/abc
|
||||
Version: 1.0
|
||||
Author: Ozh
|
||||
Author URI: http://ozh.org/
|
||||
*/
|
||||
|
||||
|
||||
/*********************************************************************************
|
||||
* DISCLAIMER *
|
||||
* This is stupid. The web is case sensitive and http://bit.ly/BLAH is different *
|
||||
* from http://bit.ly/blah. Deal with it. More about this: see *
|
||||
* http://www.w3.org/TR/WD-html40-970708/htmlweb.html *
|
||||
* *
|
||||
* This said, lots of users are pestering me for that kind of plugin, so there *
|
||||
* it is. Have fun breaking the web! :) *
|
||||
*********************************************************************************/
|
||||
|
||||
// Redirection: http://sho.rt/ABC first converted to http://sho.rt/abc
|
||||
yourls_add_filter( 'get_request', 'ozh_break_the_web_lowercase' );
|
||||
function ozh_break_the_web_lowercase( $keyword ){
|
||||
return strtolower( $keyword );
|
||||
}
|
||||
|
||||
// Short URL creation: custom keyword 'ABC' converted to 'abc'
|
||||
yourls_add_action( 'add_new_link_custom_keyword', 'ozh_break_the_web_add_filter' );
|
||||
function ozh_break_the_web_add_filter() {
|
||||
yourls_add_filter( 'get_shorturl_charset', 'ozh_break_the_web_add_uppercase' );
|
||||
yourls_add_filter( 'custom_keyword', 'ozh_break_the_web_lowercase' );
|
||||
}
|
||||
function ozh_break_the_web_add_uppercase( $charset ) {
|
||||
return $charset . strtoupper( $charset );
|
||||
}
|
||||
|
21
user/plugins/force-lowercase/readme.md
Normal file
21
user/plugins/force-lowercase/readme.md
Normal file
@ -0,0 +1,21 @@
|
||||
Plugin for YOURLS 1.5+: Force Lowercase
|
||||
|
||||
# What for
|
||||
|
||||
Force short urls to lowercase so that http://sho.rt/ABC is the same as http://sho.rt/abc
|
||||
|
||||
# How to
|
||||
|
||||
* In `/user/plugins`, create a new folder named `force-lowercase`
|
||||
* Drop these files in that directory
|
||||
* Go to the Plugins administration page and activate the plugin
|
||||
* Have fun
|
||||
|
||||
# Disclaimer: this is stupid
|
||||
|
||||
Disclaimer: this is **stupid**. The web is case sensitive, http://bit.ly/BLAH is different from http://bit.ly/blah. Deal with it.
|
||||
|
||||
More about this: see http://www.w3.org/TR/WD-html40-970708/htmlweb.html and particularly the part that says:
|
||||
>URLs in general are case-sensitive (with the exception of machine names). There may be URLs, or parts of URLs, where case doesn't matter, but identifying these may not be easy. Users should always consider that URLs are case-sensitive.
|
||||
|
||||
This said, lots of users are pestering me for that kind of plugin, so there it is. Have fun breaking the web! :)
|
Reference in New Issue
Block a user