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

60 lines
1.9KB

  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. require_once(DEDEINC."/taglib/flink.lib.php");
  4. /**
  5. * 友情链接
  6. *
  7. * @version $Id: flinktype.lib.php 1 15:57 2011年2月18日Z niap $
  8. * @package DedeBIZ.Taglib
  9. * @copyright Copyright (c) 2022, DedeBIZ.COM
  10. * @license https://www.dedebiz.com/license
  11. * @link https://www.dedebiz.com
  12. */
  13. function lib_flinktype(&$ctag, &$refObj)
  14. {
  15. global $dsql;
  16. $attlist = "row|24,titlelen|24";
  17. FillAttsDefault($ctag->CAttribute->Items, $attlist);
  18. extract($ctag->CAttribute->Items, EXTR_SKIP);
  19. $totalrow = $row;
  20. $revalue = '';
  21. $equery = "SELECT * FROM `#@__flinktype` order by id asc limit 0,$totalrow";
  22. if (trim($ctag->GetInnerText()) == '') $innertext = "<li>[field:typename /]</li>";
  23. else $innertext = $ctag->GetInnerText();
  24. if (!isset($type)) $type = '';
  25. $dtp = new DedeTagParse();
  26. $dtp->SetNameSpace("dede", "{", "}");
  27. $dtp->LoadString($innertext);
  28. $dsql->SetQuery($equery);
  29. $dsql->Execute();
  30. $rs = '';
  31. $row = array();
  32. while ($dbrow = $dsql->GetObject()) {
  33. $row[] = $dbrow;
  34. }
  35. $DedeBIZ = new stdClass;
  36. $DedeBIZ->id = 999;
  37. $DedeBIZ->typename = '织梦链';
  38. if ($type == 'DedeBIZ') $row[] = $DedeBIZ;
  39. foreach ($row as $key => $value) {
  40. if (is_array($dtp->CTags)) {
  41. $GLOBALS['envs']['flinkid'] = $value->id;
  42. foreach ($dtp->CTags as $tagid => $ctag) {
  43. $tagname = $ctag->GetName();
  44. if ($tagname == "flink") $dtp->Assign($tagid, lib_flink($ctag, $refObj));
  45. }
  46. }
  47. $rs = $dtp->GetResult();
  48. $rs = preg_replace("/\[field:id([\/\s]{0,})\]/isU", $value->id, $rs);
  49. $rs = preg_replace("/\[field:typename([\/\s]{0,})\]/isU", $value->typename, $rs);
  50. $revalue .= $rs;
  51. }
  52. return $revalue;
  53. }