diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2007-04-06 04:39:51 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2007-04-06 04:39:51 +0000 |
commit | f3cd2da113853bef53b733a09a92e59c04d5ec51 (patch) | |
tree | 4d73f51c97e77177687b854a609ef01024aab51a /modules/comment/comment.module | |
parent | c504141f457401cd26adc6ea47f251e99cf930c9 (diff) | |
download | brdo-f3cd2da113853bef53b733a09a92e59c04d5ec51.tar.gz brdo-f3cd2da113853bef53b733a09a92e59c04d5ec51.tar.bz2 |
#130991: Custom menu items, part 1
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r-- | modules/comment/comment.module | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 1c650eaff..e3b0a4e51 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1989,6 +1989,26 @@ function comment_invoke_comment(&$comment, $op) { return $return; } + +/** + * Generate vancode. + * + * Consists of a leading character indicating length, followed by N digits + * with a numerical value in base 36. Vancodes can be sorted as strings + * without messing up numerical order. + * + * It goes: + * 00, 01, 02, ..., 0y, 0z, + * 110, 111, ... , 1zy, 1zz, + * 2100, 2101, ..., 2zzy, 2zzz, + * 31000, 31001, ... + */ +function int2vancode($i = 0) { + $num = base_convert((int)$i, 10, 36); + $length = strlen($num); + return chr($length + ord('0') - 1) . $num; +} + /** * Decode vancode back to an integer. */ |