discuz_rank.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: discuz_rank.php 27449 2012-02-01 05:32:35Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class discuz_rank extends discuz_base
  12. {
  13. public $name = '';
  14. public function __construct($name) {
  15. if($name) {
  16. $this->name = $name;
  17. } else {
  18. throw new Exception('The property "'.get_class($this).'->name" is empty');
  19. }
  20. }
  21. public function fetch_list($order = 'DESC', $start = 0, $limit = 0) {
  22. return C::t('common_rank')->fetch_list($this->name, $order, $limit);
  23. }
  24. public function fetch_rank($key) {
  25. return C::t('common_rank')->fetch_rank($this->name, $key);
  26. }
  27. public function set($key, $value) {
  28. return C::t('common_rank')->insert($this->name, $key, $value);
  29. }
  30. public function inc($key, $value) {
  31. return C::t('common_rank')->inc($this->name, $key, $value);
  32. }
  33. public function dec($key, $value) {
  34. return C::t('common_rank')->dec($this->name, $key, $value);
  35. }
  36. public function clear() {
  37. return C::t('common_rank')->delete($this->name);
  38. }
  39. public function rm($key) {
  40. return $key ? C::t('common_rank')->delete($this->name, $key) : false;
  41. }
  42. }
  43. ?>