global.func.php 1012 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * 解析评论ID
  4. * @param $commentid 评论ID
  5. */
  6. function decode_commentid($commentid) {
  7. return explode('-', $commentid);
  8. }
  9. /**
  10. * 方向生成
  11. * @param $direction
  12. */
  13. function direction($direction) {
  14. switch($direction){
  15. case 1:
  16. return '<img src="'.IMG_PATH.'/icon/zheng.png" />';
  17. break;
  18. case 2:
  19. return '<img src="'.IMG_PATH.'/icon/fan.png" />';
  20. break;
  21. case 3:
  22. return '<img src="'.IMG_PATH.'/icon/zhong.png" />';
  23. break;
  24. }
  25. }
  26. /**
  27. * 通过API接口调用标题和URL数据
  28. * @param string $commentid 评论ID
  29. * @return array($title, $url) 返回数据
  30. */
  31. function get_comment_api($commentid) {
  32. list($modules, $contentid, $siteid) = id_decode($commentid);
  33. if (empty($modules) || empty($siteid) || empty($contentid)) {
  34. return false;
  35. }
  36. $comment_api = '';
  37. $module = explode('_', $modules);
  38. $comment_api = pc_base::load_app_class('comment_api', $module[0]);
  39. if (empty($comment_api)) return false;
  40. return $comment_api->get_info($modules, $contentid, $siteid);
  41. }