国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.8KB

  1. <?php if(!defined('DEDEINC')) exit('Request Error!');
  2. /**
  3. * QRCode
  4. *
  5. * @version $Id: qrcode.lib.php 1 9:29 2020年9月14日 tianya $
  6. * @package DedeCMS.Taglib
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. $GLOBALS['qrcode_id'] = isset($GLOBALS['qrcode_id'])? $GLOBALS['qrcode_id'] : 1;
  12. function lib_qrcode(&$ctag,&$refObj)
  13. {
  14. //属性处理
  15. $attlist="type|,id|";
  16. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  17. extract($ctag->CAttribute->Items, EXTR_SKIP);
  18. //var_dump($refObj->Fields['id']);
  19. if ( empty($type) AND empty($id) )
  20. {
  21. if ( get_class ($refObj) == 'Archives' )
  22. {
  23. $type = 'arc';
  24. $id = $refObj->Fields['id'];
  25. } elseif ( get_class($refObj)=='ListView' OR get_class($refObj)=='SgListView')
  26. {
  27. $type = 'list';
  28. $id = $refObj->Fields['id'];
  29. } elseif ( get_class($refObj) =='PartView' AND !empty($refObj->Fields['id']) )
  30. {
  31. $type = 'list';
  32. $id = $refObj->Fields['id'];
  33. } elseif ( get_class($refObj) =='PartView' AND empty($refObj->Fields['id']) )
  34. {
  35. $type = 'index';
  36. $id = 0;
  37. }
  38. }
  39. $reval=<<<EOT
  40. <a href='https://www.dedebiz.com/' id='__dedeqrcode_{$GLOBALS['qrcode_id']}'>二维码、二维码生成</a>
  41. <script type="text/javascript">
  42. var __dedeqrcode_id={$GLOBALS['qrcode_id']};
  43. var __dedeqrcode_aid={$id};
  44. var __dedeqrcode_type='{$type}';
  45. var __dedeqrcode_dir='{$GLOBALS['cfg_plus_dir']}';
  46. </script>
  47. <script language="javascript" type="text/javascript" src="{$GLOBALS['cfg_static_dir']}/img/qrcode.js"></script>
  48. EOT;
  49. $GLOBALS['qrcode_id']++;
  50. return $reval;
  51. }