国内流行的内容管理系统(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.

58 lines
1.9KB

  1. <?php if(!defined('DEDEINC')) exit('Request Error!');
  2. /**
  3. * 自定义宏标记调用标签
  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/v6
  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. global $dsql, $envs;
  15. //属性处理
  16. $attlist="type|,id|";
  17. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  18. extract($ctag->CAttribute->Items, EXTR_SKIP);
  19. //var_dump($refObj->Fields['id']);
  20. if ( empty($type) AND empty($id) )
  21. {
  22. if ( get_class ($refObj) == 'Archives' )
  23. {
  24. $type = 'arc';
  25. $id = $refObj->Fields['id'];
  26. } elseif ( get_class($refObj)=='ListView' OR get_class($refObj)=='SgListView')
  27. {
  28. $type = 'list';
  29. $id = $refObj->Fields['id'];
  30. } elseif ( get_class($refObj) =='PartView' AND !empty($refObj->Fields['id']) )
  31. {
  32. $type = 'list';
  33. $id = $refObj->Fields['id'];
  34. } elseif ( get_class($refObj) =='PartView' AND empty($refObj->Fields['id']) )
  35. {
  36. $type = 'index';
  37. $id = 0;
  38. }
  39. }
  40. $reval=<<<EOT
  41. <a href='http://2v.dedecms.com/' id='__dedeqrcode_{$GLOBALS['qrcode_id']}'>织梦二维码生成器</a>
  42. <script type="text/javascript">
  43. var __dedeqrcode_id={$GLOBALS['qrcode_id']};
  44. var __dedeqrcode_aid={$id};
  45. var __dedeqrcode_type='{$type}';
  46. var __dedeqrcode_dir='{$GLOBALS['cfg_plus_dir']}';
  47. </script>
  48. <script language="javascript" type="text/javascript" src="{$GLOBALS['cfg_static_dir']}/img/qrcode.js"></script>
  49. EOT;
  50. $GLOBALS['qrcode_id']++;
  51. return $reval;
  52. }