├── .gitignore ├── README.md └── case-insensitive └── plugin.php /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | YOURLS Case Insensitive Plugin 2 | ============================== 3 | 4 | Makes all keywords case insensitive (creates all keywords and calls all keywords lowercase.) Only works if you are using Base 36. Fixes disappearing capital letters. 5 | 6 | Installation 7 | ------------ 8 | 9 | Move the `case-insensitive` folder into the `/users/plugins` folder. Then, activate the plugin in the admin interface. That's all there is to it. 10 | 11 | Requirements 12 | ------------ 13 | 14 | User must have [YOURLS](http://yourls.org/#Install) 1.5.1+ installed. 15 | 16 | Bonus 17 | ----- 18 | 19 | Works with [YOURLS QR Code Plugin](https://github.com/seandrickson/yourls-qrcode-plugin) to generate smaller QR codes! This is because QR codes store upper-case characters significantly more efficiently than lower-case (ratio 5.5:8) 20 | 21 | Credits 22 | ------- 23 | 24 | Borrowed code from Ozh's [Force Lowercase](https://github.com/YOURLS/force-lowercase) plugin 25 | -------------------------------------------------------------------------------- /case-insensitive/plugin.php: -------------------------------------------------------------------------------- 1 | Sean's QR Code plugin 6 | Version: 1.0 7 | Author: Sean Hendrickson 8 | Author URI: https://github.com/seandrickson 9 | */ 10 | 11 | // No direct call 12 | if( !defined( 'YOURLS_ABSPATH' ) ) die(); 13 | 14 | 15 | // Redirection: http://sho.rt/ABC first converted to http://sho.rt/abc 16 | yourls_add_filter( 'get_request', 'sean_convert_to_lowercase' ); 17 | function sean_convert_to_lowercase( $keyword ) { 18 | return (YOURLS_URL_CONVERT==36) ? $keyword=strtolower($keyword) : $keyword; 19 | } 20 | 21 | 22 | // Short URL creation: custom keyword 'ABC' converted to 'abc' 23 | yourls_add_action( 'add_new_link_custom_keyword', 'sean_case_insensitive_add_filter' ); 24 | function sean_case_insensitive_add_filter() { 25 | yourls_add_filter( 'get_shorturl_charset', 'sean_allow_capitals' ); 26 | yourls_add_filter( 'custom_keyword', 'sean_convert_to_lowercase' ); 27 | } 28 | 29 | function sean_allow_capitals( $charset ) { 30 | return (YOURLS_URL_CONVERT==36) ? $charset=$charset.strtoupper($charset) : $charset; 31 | } 32 | --------------------------------------------------------------------------------