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

47 lines
1.6KB

  1. <?php if(!defined('DEDEINC')) exit('Request Error!');
  2. $GLOBALS['qrcode_id'] = isset($GLOBALS['qrcode_id'])? $GLOBALS['qrcode_id'] : 1;
  3. function lib_qrcode(&$ctag,&$refObj)
  4. {
  5. global $dsql, $envs;
  6. //属性处理
  7. $attlist="type|,id|";
  8. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  9. extract($ctag->CAttribute->Items, EXTR_SKIP);
  10. //var_dump($refObj->Fields['id']);
  11. if ( empty($type) AND empty($id) )
  12. {
  13. if ( get_class ($refObj) == 'Archives' )
  14. {
  15. $type = 'arc';
  16. $id = $refObj->Fields['id'];
  17. } elseif ( get_class($refObj)=='ListView' OR get_class($refObj)=='SgListView')
  18. {
  19. $type = 'list';
  20. $id = $refObj->Fields['id'];
  21. } elseif ( get_class($refObj) =='PartView' AND !empty($refObj->Fields['id']) )
  22. {
  23. $type = 'list';
  24. $id = $refObj->Fields['id'];
  25. } elseif ( get_class($refObj) =='PartView' AND empty($refObj->Fields['id']) )
  26. {
  27. $type = 'index';
  28. $id = 0;
  29. }
  30. }
  31. $reval=<<<EOT
  32. <a href='http://2v.dedecms.com/' id='__dedeqrcode_{$GLOBALS['qrcode_id']}'>织梦二维码生成器</a>
  33. <script type="text/javascript">
  34. var __dedeqrcode_id={$GLOBALS['qrcode_id']};
  35. var __dedeqrcode_aid={$id};
  36. var __dedeqrcode_type='{$type}';
  37. var __dedeqrcode_dir='{$GLOBALS['cfg_plus_dir']}';
  38. </script>
  39. <script language="javascript" type="text/javascript" src="{$GLOBALS['cfg_static_dir']}/img/qrcode.js"></script>
  40. EOT;
  41. $GLOBALS['qrcode_id']++;
  42. return $reval;
  43. }