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 --- include/bbcode.php | 7 ++++++- include/html2bbcode.php | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'include') 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 From 98dcc195117bab35363c75e14af08858b6dbba3d Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Dec 2010 14:36:35 -0800 Subject: page_header hook --- include/nav.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/nav.php b/include/nav.php index af0c58710..74b4defc3 100644 --- a/include/nav.php +++ b/include/nav.php @@ -49,7 +49,6 @@ $a->page['nav'] .= '' . t('Contacts') . "\r\n"; - } @@ -57,9 +56,10 @@ $banner = get_config('system','banner'); - if($banner === false) $banner .= 'logoFriendika'; $a->page['nav'] .= ''; + + call_hooks('page_header', $a->page['nav']); -- cgit v1.2.3 From 9296d178b3696a0cf408d006b7fb9832a3344dcb Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Dec 2010 18:32:49 -0800 Subject: html5 video/audio support - still needs multiple source selection, and check that it isn't blocked by html purifier --- include/bbcode.php | 7 ++++ include/html2bbcode.php | 102 ++++++++++++++++++++++++++---------------------- 2 files changed, 63 insertions(+), 46 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 7e901bd41..646401ddb 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -77,6 +77,13 @@ function bbcode($Text) { // Images // [img]pathtoimage[/img] $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '', $Text); + + // html5 video and audio + + $Text = preg_replace("/\[video\](.+?)\[\/video\]/", '', $Text); + + $Text = preg_replace("/\[audio\](.+?)\[\/audio\]/", '', $Text); + // [img=widthxheight]image source[/img] $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '', $Text); diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 1f3d63a0d..b99329230 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -1,52 +1,62 @@ (.*?)\<\/b\>/is', + '/\(.*?)\<\/i\>/is', + '/\(.*?)\<\/u\>/is', + '/\(.*?)\<\/ul\>/is', + '/\(.*?)\<\/li\>/is', + '/\/is', + '/\(.*?)\<\/div\>/is', + '/\/is', + '/\(.*?)\<\/strong\>/is', + '/\(.*?)\<\/a\>/is', + '/\(.*?)\<\/code\>/is', + '/\(.*?)\<\/span\>/is', + '/\(.*?)\<\/blockquote\>/is', + '/\(.*?)/is', + '/\(.*?)/is', + + ); + + // Replace with + + $bbtags = array( + '', + '[b]$1[/b]', + '[i]$1[/i]', + '[u]$1[/u]', + '[list]$1[/list]', + '[*]$1', + '[img]$2[/img]', + '$2', + "\n", + '[b]$1[/b]', + '[url=$1]$3[/url]', + '[code]$1[/code]', + '[color="$1"]$2[/color]', + '[quote]$1[/quote]', + '[video]$1[/video]', + '[audio]$1[/audio]', + ); + + // 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; +} -// Tags to Find -$htmltags = array( - '/\n/is', - '/\(.*?)\<\/b\>/is', - '/\(.*?)\<\/i\>/is', - '/\(.*?)\<\/u\>/is', - '/\(.*?)\<\/ul\>/is', - '/\(.*?)\<\/li\>/is', - '/\/is', - '/\(.*?)\<\/div\>/is', - '/\/is', - '/\(.*?)\<\/strong\>/is', - '/\(.*?)\<\/a\>/is', - '/\(.*?)\<\/code\>/is', - '/\(.*?)\<\/span\>/is', - '/\(.*?)\<\/blockquote\>/is', - - ); - -// Replace with -$bbtags = array( - '', - '[b]$1[/b]', - '[i]$1[/i]', - '[u]$1[/u]', - '[list]$1[/list]', - '[*]$1', - '[img]$2[/img]', - '$2', - "\n", - '[b]$1[/b]', - '[url=$1]$3[/url]', - '[code]$1[/code]', - '[color="$1"]$2[/color]', - '[quote]$1[/quote]', - ); - -// 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; -} \ No newline at end of file -- cgit v1.2.3 From afaacd134c7127a66741c452818f9bfc00d48dd8 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Dec 2010 18:43:42 -0800 Subject: linkify audio/video links for non-html5 browsers (or those with unsupported codecs?) --- include/bbcode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 646401ddb..ef31f5a66 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -80,9 +80,9 @@ function bbcode($Text) { // html5 video and audio - $Text = preg_replace("/\[video\](.+?)\[\/video\]/", '', $Text); + $Text = preg_replace("/\[video\](.+?)\[\/video\]/", '$1', $Text); - $Text = preg_replace("/\[audio\](.+?)\[\/audio\]/", '', $Text); + $Text = preg_replace("/\[audio\](.+?)\[\/audio\]/", '', $Text); // [img=widthxheight]image source[/img] -- cgit v1.2.3 From 53928bec875bd15576d3157c678bf29e215eb63b Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Dec 2010 21:08:06 -0800 Subject: oops escape left angles in expressions --- include/html2bbcode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/html2bbcode.php b/include/html2bbcode.php index b99329230..1aaaffc55 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -24,8 +24,8 @@ function html2bbcode($s) { '/\(.*?)\<\/code\>/is', '/\(.*?)\<\/span\>/is', '/\(.*?)\<\/blockquote\>/is', - '/\(.*?)/is', - '/\(.*?)/is', + '/\(.*?)\/is', + '/\(.*?)\/is', ); -- cgit v1.2.3 From e490c9459d066d4658f46b4b37b5c9321b0e7956 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Dec 2010 21:09:58 -0800 Subject: and right angles --- include/html2bbcode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 1aaaffc55..f5790217a 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -24,8 +24,8 @@ function html2bbcode($s) { '/\(.*?)\<\/code\>/is', '/\(.*?)\<\/span\>/is', '/\(.*?)\<\/blockquote\>/is', - '/\(.*?)\/is', - '/\(.*?)\/is', + '/\(.*?)\/is', + '/\(.*?)\/is', ); -- cgit v1.2.3 From ca83d24c0253a769f3e55c312dfd3bcd5fa7dfc7 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Dec 2010 23:48:11 -0800 Subject: and slashes - sigh... --- include/html2bbcode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/html2bbcode.php b/include/html2bbcode.php index f5790217a..688c01452 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -24,8 +24,8 @@ function html2bbcode($s) { '/\(.*?)\<\/code\>/is', '/\(.*?)\<\/span\>/is', '/\(.*?)\<\/blockquote\>/is', - '/\(.*?)\/is', - '/\(.*?)\/is', + '/\(.*?)\<\/video\>/is', + '/\(.*?)\<\/audio\>/is', ); -- cgit v1.2.3 From d8985b3a548422dca8a8d659f4c66975366818df Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 1 Jan 2011 13:12:31 -0800 Subject: try to auto-fill the profile address if we actually do know it. --- include/items.php | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 22d47d44f..6f73984e2 100644 --- a/include/items.php +++ b/include/items.php @@ -157,7 +157,6 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) { '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) )); - call_hooks('atom_feed', $atom); if(! count($items)) { -- cgit v1.2.3