need('components/header.php'); global $groupedLinks; $groupedLinks = array(); /** * 解析 [Links ...] 短代码,分组存储到 $groupedLinks * @param string $content * @return string 处理后的内容 */ function parseLinksShortcode($content) { global $groupedLinks; // 匹配所有 [Links ... /] 短代码 preg_match_all('/\[Links\s+([^\]]+)\s*\/\]/', $content, $matches, PREG_SET_ORDER); $defaults = array( 'title' => '', 'url' => '', 'avatar' => '', 'desc' => '', 'group' => '网上邻居', 'status' => '正常', ); foreach ($matches as $match) { $link = array_merge(array(), $defaults); // 支持引号和未加引号的属性 preg_match_all('/(\w+)=(["\'])(.*?)\2|(\w+)=([^\s]+)/', $match[1], $attrs, PREG_SET_ORDER); foreach ($attrs as $attr) { if (!empty($attr[1])) { $key = strtolower($attr[1]); $value = $attr[3]; } else { $key = strtolower($attr[4]); $value = $attr[5]; } if (array_key_exists($key, $defaults)) { $link[$key] = htmlspecialchars_decode($value); } } if (empty($link['group'])) { $link['group'] = '网上邻居'; } $group = $link['group']; if (!isset($groupedLinks[$group])) { $groupedLinks[$group] = array(); } $groupedLinks[$group][] = $link; } $content = preg_replace('/\[Links\s+[^\]]+\s*\/\]/', '', $content); $content = preg_replace('#

|



#si', '', $content); $content = preg_replace('#

(\s*)+

#i', '', $content); return $content; } $content = parseLinksShortcode($this->content); ?>

authorId ? $this->author->screenName() : $this->user->screenName(); ?>のTA的朋友们

$links): ?>

<?php echo $link['title']; ?>

本站添加的友链要求

options->svgName(); ?>

[必选]申请前请先确认您是否符合以下条件:

need('components/comments.php'); ?>
need('components/footer.php'); ?>