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

63 lines
1.9KB

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