plugin hooks for bbcode conversions
This commit is contained in:
parent
fd71d19463
commit
279469ab35
|
@ -107,6 +107,12 @@ Current hooks:
|
||||||
'contacts' => contact array of entries
|
'contacts' => contact array of entries
|
||||||
'output' => the (string) generated HTML of the contact block
|
'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
|
*** = subject to change
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// BBcode 2 HTML was written by WAY2WEB.net
|
// BBcode 2 HTML was written by WAY2WEB.net
|
||||||
// Made to work with Mistpark/Friendika - Mike Macgirvin
|
// extended to work with Mistpark/Friendika - Mike Macgirvin
|
||||||
|
|
||||||
function bbcode($Text) {
|
function bbcode($Text) {
|
||||||
|
|
||||||
// Replace any html brackets with HTML Entities to prevent executing HTML or script
|
// Replace any html brackets with HTML Entities to prevent executing HTML or script
|
||||||
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
|
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
|
||||||
|
|
||||||
$Text = str_replace("<", "<", $Text);
|
$Text = str_replace("<", "<", $Text);
|
||||||
$Text = str_replace(">", ">", $Text);
|
$Text = str_replace(">", ">", $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\]http:\/\/www.youtube.com\/watch\?v\=(.+?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
|
||||||
$Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);
|
$Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);
|
||||||
|
|
||||||
|
call_hooks('bbcode',$Text);
|
||||||
|
|
||||||
return $Text;
|
return $Text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@ $bbtags = array(
|
||||||
// Replace $htmltags in $text with $bbtags
|
// Replace $htmltags in $text with $bbtags
|
||||||
$text = preg_replace ($htmltags, $bbtags, $s);
|
$text = preg_replace ($htmltags, $bbtags, $s);
|
||||||
|
|
||||||
|
call_hooks('html2bbcode', $text);
|
||||||
|
|
||||||
// Strip all other HTML tags
|
// Strip all other HTML tags
|
||||||
$text = strip_tags($text);
|
$text = strip_tags($text);
|
||||||
return $text;
|
return $text;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user