diff --git a/include/functions.php b/include/functions.php index d11edfcf..c3c5a4a0 100644 --- a/include/functions.php +++ b/include/functions.php @@ -283,6 +283,20 @@ function formatYoutube($src, $width = '', $height = ''): string )); } +function formatVideo($src, $width, $height) { + if (!$width) { + $width = 560; + } + if (!$height) { + $height = 315; + } + return addTempCode(""); +} + +function formatAudio($src) { + return addTempCode(""); +} + function formatSpoiler($content, $title = '', $defaultCollapsed = true): string { global $lang_functions; @@ -301,6 +315,11 @@ function formatSpoiler($content, $title = '', $defaultCollapsed = true): string return addTempCode($HTML); } +function formatHidden($content): string +{ + return addTempCode(sprintf('%s', $content)); +} + function formatTextAlign($text, $align): string { return addTempCode(sprintf('
%s
', $align, $text)); @@ -346,8 +365,8 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab = // Linebreaks $s = nl2br($s); - $originalBbTagArray = array('[siteurl]', '[site]','[*]', '[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[pre]', '[/pre]', '[/color]', '[/font]', '[/size]', " "); - $replaceXhtmlTagArray = array(get_protocol_prefix().get_setting('basic.BASEURL'), get_setting('basic.SITENAME'), 'list', '', '', '', '', '', '', '
', '
', '', '', '', '  '); + $originalBbTagArray = array('[siteurl]', '[site]','[*]', '[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[s]', '[/s]', '[pre]', '[/pre]', '[/color]', '[/font]', '[/size]', '[hr]', " "); + $replaceXhtmlTagArray = array(get_protocol_prefix().get_setting('basic.BASEURL'), get_setting('basic.SITENAME'), '• ', '', '', '', '', '', '', '', '', '
', '
', '', '', '', '
', '  '); $s = str_replace($originalBbTagArray, $replaceXhtmlTagArray, $s); $originalBbTagArray = array("/\[font=([^\[\(&\\;]+?)\]/is", "/\[color=([#0-9a-z]{1,15})\]/is", "/\[color=([a-z]+)\]/is", "/\[size=([1-7])\]/is"); @@ -397,6 +416,17 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab = $s = preg_replace_callback("/\[youtube(\,([1-9][0-9]*)\,([1-9][0-9]*))?\]((http|https):\/\/[^\s'\"<>]+)\[\/youtube\]/i", function ($matches) { return formatYoutube($matches[4], $matches[2], $matches[3]); }, $s); + } + if (str_contains($s, "[video")) { + $s = preg_replace_callback("/\[video(\,([1-9][0-9]*)\,([1-9][0-9]*))?\]((http|https):\/\/[^\s'\"<>]+)\[\/video\]/i", function ($matches) { + return formatVideo($matches[4], $matches[2], $matches[3]); + }, $s); + } + if (str_contains($s, "[audio")) { + $s = preg_replace_callback("/\[audio\]((http|https):\/\/[^\s'\"<>]+)\[\/audio\]/i", function ($matches) { + return formatAudio($matches[1]); + }, $s); + } // [url=http://www.example.com]Text[/url] @@ -433,6 +463,11 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab = return formatTextAlign($matches[1], 'right'); }, $s); + // [hide]Hidden text[/hide] + $s = preg_replace_callback("/\[hide\](.*)\[\/hide\]/isU", function ($matches) { + return formatHidden($matches[1]); + }, $s); + $s = format_urls($s, $newtab); // Quotes @@ -5557,7 +5592,7 @@ function strip_all_tags($text) { //替换掉无参数标签 $bbTags = [ - '[*]', '[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[pre]', '[/pre]', '[quote]', '[/quote]', + '[*]', '[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[s]', '[/s]', '[pre]', '[/pre]', '[quote]', '[/quote]', '[/color]', '[/font]', '[/size]', '[/url]', '[/youtube]', '[/spoiler]', ]; $text = str_replace($bbTags, '', $text); diff --git a/lang/chs/lang_tags.php b/lang/chs/lang_tags.php index 34e47912..e069550b 100644 --- a/lang/chs/lang_tags.php +++ b/lang/chs/lang_tags.php @@ -22,6 +22,14 @@ $lang_tags = array 'text_underline_description' => "在文字下加划线", 'text_underline_syntax' => "[u]文字[/u]", 'text_underline_example' => "[u]这是下划线[/u]", + 'text_strikethrough' => "删除线", + 'text_strikethrough_description' => "为文字添加删除线", + 'text_strikethrough_syntax' => "[s]文字[/s]", + 'text_strikethrough_example' => "[s]这是删除线[/s]", + 'text_hide' => '隐藏', + 'text_hide_description' => '使文字隐藏', + 'text_hide_syntax' => '[hide]文字[/hide]', + 'text_hide_example' => '[hide]I tried so hard and got so far[/hide]', 'text_color_one' => "颜色 (方式1)", 'text_color_one_description' => "改变文字颜色", 'text_color_one_syntax' => "[color=Color]文字[/color]", @@ -114,7 +122,15 @@ $lang_tags = array 'text_youtube' => "YouTube", 'text_youtube_description' => "在页面内插入YouTube网站的在线视频", 'text_youtube_syntax' => "[youtube,width,height]YouTube视频的URL[/youtube]", - 'text_youtube_example' => "[youtube,560,315]https://www.youtube.com/watch?v=DWDL3VTCcCg&ab_channel=ESPNMMA[/youtube]", + 'text_youtube_example' => "[youtube,560,315]https://www.youtube.com/watch?v=dQw4w9WgXcQ[/youtube]", + 'text_video' => "视频", + 'text_video_description' => "在页面内插入HTML5视频播放器", + 'text_video_syntax' => "[video,width,height]视频的URL[/video]", + 'text_video_example' => "[video]https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm[/video]", + 'text_audio' => "音频", + 'text_audio_description' => "在页面内插入HTML5音频播放器", + 'text_audio_syntax' => "[audio]音频的URL[/audio]", + 'text_audio_example' => "[audio]https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3[/audio]", 'text_youku' => "优酷", 'text_youku_description' => "在页面内插入优酷网的在线视频", 'text_youku_syntax' => "[youku]优酷网视频的URL[/youku]", @@ -132,6 +148,10 @@ $lang_tags = array 'text_spoiler_description' => '在页面插入可展开/收缩的内容', 'text_spoiler_syntax' => '[spoiler=标题]这是被折叠的内容[/spoiler]', 'text_spoiler_example' => '[spoiler=英雄最后的结局怎么样了?]英雄最后死掉了![/spoiler]', + 'text_hr' => '水平线', + 'text_hr_description' => '在页面内插入水平线', + 'text_hr_syntax' => '[hr]', + 'text_hr_example' => 'Never gonna give you up[hr]Never gonna let you down', 'text_left' => '靠左对齐', 'text_left_description' => '在页面插入靠左对齐的内容', diff --git a/lang/en/lang_tags.php b/lang/en/lang_tags.php index 87badc73..7c0aa00e 100644 --- a/lang/en/lang_tags.php +++ b/lang/en/lang_tags.php @@ -22,6 +22,14 @@ $lang_tags = array 'text_underline_description' => "Makes the enclosed text underlined.", 'text_underline_syntax' => "[u]Text[/u]", 'text_underline_example' => "[u]This is underlined text.[/u]", + 'text_strikethrough' => "Strikethrough", + 'text_strikethrough_description' => "Makes the enclosed text strikethrough.", + 'text_strikethrough_syntax' => "[s]Text[/s]", + 'text_strikethrough_example' => "[s]This is strikethrough text.[/s]", + 'text_hide' => 'Hidden', + 'text_hide_description' => 'Makes the enclosed text hidden', + 'text_hide_syntax' => '[hide]Text[/hide]', + 'text_hide_example' => '[hide]I tried so hard and got so far[/hide]', 'text_color_one' => "Color (alt. 1)", 'text_color_one_description' => "Changes the color of the enclosed text.", 'text_color_one_syntax' => "[color=Color]Text[/color]", @@ -114,7 +122,15 @@ $lang_tags = array 'text_youtube' => "YouTube", 'text_youtube_description' => "Insert YouTube online video in webpages", 'text_youtube_syntax' => "[youtube,width,height]Video URL on YouTube[/youtube]", - 'text_youtube_example' => "[youtube,560,315]https://www.youtube.com/watch?v=DWDL3VTCcCg&ab_channel=ESPNMMA[/youtube]", + 'text_youtube_example' => "[youtube,560,315]https://www.youtube.com/watch?v=dQw4w9WgXcQ[/youtube]", + 'text_video' => "Video", + 'text_video_description' => "Insert HTML5 video player", + 'text_video_syntax' => "[video,width,height]Video URL[/video]", + 'text_video_example' => "[video]https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm[/video]", + 'text_audio' => "Audio", + 'text_audio_description' => "Insert HTML5 audio player", + 'text_audio_syntax' => "[audio]Audio URL[/audio]", + 'text_audio_example' => "[audio]https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3[/audio]", 'text_youku' => "YouKu", 'text_youku_description' => "Insert YouKu online video in webpages", 'text_youku_syntax' => "[youku]Video URL on YouKu[/youku]", @@ -132,6 +148,10 @@ $lang_tags = array 'text_spoiler_description' => 'Insert expandable/collapsible content on the page', 'text_spoiler_syntax' => '[spoiler=title]This is the folded content[/spoiler]', 'text_spoiler_example' => '[spoiler=What happened to the final ending of the hero?]The hero died last![/spoiler]', + 'text_hr' => 'Horizontal rule', + 'text_hr_description' => 'Insert horizontal rule content on the page', + 'text_hr_syntax' => '[hr]', + 'text_hr_example' => 'Never gonna give you up[hr]Never gonna let you down', 'text_left' => 'Text align left', 'text_left_description' => 'Insert left-justified content on the page', diff --git a/public/styles/nexus.css b/public/styles/nexus.css index f5590989..be62367b 100644 --- a/public/styles/nexus.css +++ b/public/styles/nexus.css @@ -96,3 +96,11 @@ img.hitandrun { .form-control-row input[type=checkbox] { vertical-align: sub; } + +.hidden-text { + filter: blur(.5em); + transition: filter .15s ease-in-out; +} +.hidden-text:hover { + filter: blur(0); +} diff --git a/public/tags.php b/public/tags.php index e8d7cd2e..c4aaf6db 100644 --- a/public/tags.php +++ b/public/tags.php @@ -59,6 +59,22 @@ insert_tag( "" ); +insert_tag( + $lang_tags['text_strikethrough'], + $lang_tags['text_strikethrough_description'], + $lang_tags['text_strikethrough_syntax'], + $lang_tags['text_strikethrough_example'], + "" +); + +insert_tag( + $lang_tags['text_hide'], + $lang_tags['text_hide_description'], + $lang_tags['text_hide_syntax'], + $lang_tags['text_hide_example'], + "" +); + insert_tag( $lang_tags['text_color_one'], $lang_tags['text_color_one_description'], @@ -252,6 +268,24 @@ insert_tag( $lang_tags['text_youtube_example'], "" ); + + +insert_tag( + $lang_tags['text_video'], + $lang_tags['text_video_description'], + $lang_tags['text_video_syntax'], + $lang_tags['text_video_example'], + "" +); + + +insert_tag( + $lang_tags['text_audio'], + $lang_tags['text_audio_description'], + $lang_tags['text_audio_syntax'], + $lang_tags['text_audio_example'], + "" +); /* insert_tag( $lang_tags['text_youku'], @@ -286,6 +320,15 @@ insert_tag( "" ); + +insert_tag( + $lang_tags['text_hr'], + $lang_tags['text_hr_description'], + $lang_tags['text_hr_syntax'], + $lang_tags['text_hr_example'], + "" +); + end_frame(); end_main_frame(); stdfoot();