From 279469ab35596097e7942e7c2377bc50967ee953 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Dec 2010 14:21:05 -0800 Subject: plugin hooks for bbcode conversions --- addon/README | 6 ++++++ include/bbcode.php | 7 ++++++- include/html2bbcode.php | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/addon/README b/addon/README index 451b6ed72..23e1b5c6f 100644 --- a/addon/README +++ b/addon/README @@ -107,6 +107,12 @@ Current hooks: 'contacts' => contact array of entries 'output' => the (string) generated HTML of the contact block +'bbcode' - called during conversion of bbcode to html + $b is (string) converted text + +'html2bbcode' - called during conversion of html to bbcode (e.g. remote message posting) + $b is (string) converted text + *** = subject to change diff --git a/include/bbcode.php b/include/bbcode.php index 351510f6d..7e901bd41 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1,10 +1,13 @@ ", ">", $Text); @@ -82,5 +85,7 @@ function bbcode($Text) { $Text = preg_replace("/\[youtube\]http:\/\/www.youtube.com\/watch\?v\=(.+?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text); $Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '', $Text); + call_hooks('bbcode',$Text); + return $Text; } diff --git a/include/html2bbcode.php b/include/html2bbcode.php index a2e53a81b..1f3d63a0d 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -44,6 +44,8 @@ $bbtags = array( // Replace $htmltags in $text with $bbtags $text = preg_replace ($htmltags, $bbtags, $s); +call_hooks('html2bbcode', $text); + // Strip all other HTML tags $text = strip_tags($text); return $text; -- cgit v1.2.3