diff options
author | friendica <info@friendica.com> | 2012-07-30 18:51:44 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-07-30 18:51:44 -0700 |
commit | 02cc436ec7cf0cfca5fc9b5166cc537bbee53671 (patch) | |
tree | d7e5eea4e22ed1befeab5706a30ce1e1ac064972 /library/urlify/README.md | |
parent | 194c52aee590a209cc38ee8fb322ff7dc4a9143d (diff) | |
download | volse-hubzilla-02cc436ec7cf0cfca5fc9b5166cc537bbee53671.tar.gz volse-hubzilla-02cc436ec7cf0cfca5fc9b5166cc537bbee53671.tar.bz2 volse-hubzilla-02cc436ec7cf0cfca5fc9b5166cc537bbee53671.zip |
Added urlify to try and create webbie auto-suggestions out of whatever unicode stuff gets thrown in as a name. Currently this will only work for latin/european/cyrillic/russian, but possible to extend to ideographic forms.
Diffstat (limited to 'library/urlify/README.md')
-rw-r--r-- | library/urlify/README.md | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/library/urlify/README.md b/library/urlify/README.md new file mode 100644 index 000000000..7c2c42a12 --- /dev/null +++ b/library/urlify/README.md @@ -0,0 +1,70 @@ +# URLify for PHP + +A PHP port of [URLify.js](https://github.com/django/django/blob/master/django/contrib/admin/static/admin/js/urlify.js) +from the Django project. Handles symbols from Latin languages, Greek, Turkish, +Russian, Ukrainian, Czech, Polish, and Latvian. Symbols it cannot transliterate +it will simply omit. + +* Author: [jbroadway](http://github.com/jbroadway) +* License: MIT + +## Usage: + +To generate slugs for URLs: + +```php +<?php + +echo URLify::filter (' J\'étudie le français '); +// "jetudie-le-francais" + +echo URLify::filter ('Lo siento, no hablo español.'); +// "lo-siento-no-hablo-espanol" + +?> +``` + +To simply transliterate characters: + +```php +<?php + +echo URLify::downcode ('J\'étudie le français'); +// "J'etudie le francais" + +echo URLify::downcode ('Lo siento, no hablo español.'); +// "Lo siento, no hablo espanol." + +/* Or use transliterate() alias: */ + +echo URLify::transliterate ('Lo siento, no hablo español.'); +// "Lo siento, no hablo espanol." + +?> +``` + +To extend the character list: + +```php +<?php + +URLify::add_chars (array ( + '¿' => '?', '®' => '(r)', '¼' => '1/4', + '¼' => '1/2', '¾' => '3/4', '¶' => 'P' +)); + +echo URLify::downcode ('¿ ® ¼ ¼ ¾ ¶'); +// "? (r) 1/2 1/2 3/4 P" + +?> +``` + +To extend the list of words to remove: + +```php +<?php + +URLify::remove_words (array ('remove', 'these', 'too')); + +?> +``` |