diff --git a/functions.php b/functions.php index 9d5807d..a636068 100644 --- a/functions.php +++ b/functions.php @@ -55,47 +55,8 @@ function themeFields($layout) { } function exContent($content){ - // 短代码提示框,期望用数组的办法一次性实现,但是正则表达式太难了 - // $alertIcons = array('primary' => 'fas fa-info-circle', - // 'success' => 'fas fa-info-circle', - // 'info' => 'fas fa-info-circle', - // 'warning' => 'fa-exclamation-circle', - // 'danger' => 'fas fa-skull-crossbones', - // 'default' => 'fas fa-info-circle', - // 'secondary' => 'fas fa-info-circle'); - - $pattern = '/\[(primary)\](.*?)\[\s*\/\1\s*\]/'; - $replacement = ' - '; - $content = preg_replace($pattern, $replacement, $content); - - $pattern = '/\[(default)\](.*?)\[\s*\/\1\s*\]/'; - $replacement = ' - '; - $content = preg_replace($pattern, $replacement, $content); - - $pattern = '/\[(secondary)\](.*?)\[\s*\/\1\s*\]/'; - $replacement = ' - '; - $content = preg_replace($pattern, $replacement, $content); - - $pattern = '/\[(success)\](.*?)\[\s*\/\1\s*\]/'; - $replacement = ' - '; - $content = preg_replace($pattern, $replacement, $content); + // 文章内短代码 $pattern = '/\[(info)\](.*?)\[\s*\/\1\s*\]/'; $replacement = ' '; $content = preg_replace($pattern, $replacement, $content); - // $pattern = '/\[(alert-(.*?))\](.*?)\[\s*\/\1\s*\]/'; - // $replacement = ' - // '; - // $content = preg_replace($pattern, $replacement, $content); - - // 正则表达式也太难了 。・゜・(ノД`)・゜・。 - // $pattern = '/\[link (.*)\](.*)\[link\]/'; - // $replacement = ' - // $2'; - // $content = preg_replace($pattern, $replacement, $content); - // 文章 TOC 功能 - // [0]: 完整的匹配

conTent

- // [1]: 匹配中的数字 2 - // [2]: 匹配中的内容 conTent if (preg_match_all('/(.*)<\/h\d>/isU', $content, $outarr)){ $toc_out = ""; $minlevel = 6;