aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/api.php6
-rw-r--r--include/bbcode.php3
-rw-r--r--include/conversation.php10
-rw-r--r--include/items.php19
-rw-r--r--include/notifier.php6
-rw-r--r--include/text.php34
6 files changed, 51 insertions, 27 deletions
diff --git a/include/api.php b/include/api.php
index 74b4aaf6e..1334d8eae 100644
--- a/include/api.php
+++ b/include/api.php
@@ -483,11 +483,7 @@
$txt = requestdata('htmlstatus');
if((strpos($txt,'<') !== false) || (strpos($txt,'>') !== false)) {
- $txt = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
- '[youtube]$1[/youtube]', $txt);
-
- $txt = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?</iframe>#s',
- '[youtube]$1[/youtube]', $txt);
+ $txt = html2bb_video($txt);
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.DefinitionImpl', null);
diff --git a/include/bbcode.php b/include/bbcode.php
index 9abc7c439..b33be686e 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -141,6 +141,9 @@ function bbcode($Text,$preserve_nl = false) {
$Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="425" height="350" src="http://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $Text);
}
+ $Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism",'[vimeo]$1[/vimeo]',$Text);
+ $Text = preg_replace("/\[vimeo\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/vimeo\]/ism",'[vimeo]$1[/vimeo]',$Text);
+ $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="425" height="350" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $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);
diff --git a/include/conversation.php b/include/conversation.php
index 18f6d080b..29fa77902 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -745,9 +745,8 @@ function status_editor($a,$x, $notes_cid = 0) {
'$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'),
'$linkurl' => t('Please enter a link URL:'),
- '$utubeurl' => t('Please enter a YouTube link:'),
- '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"),
- '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"),
+ '$vidurl' => t("Please enter a video link/URL:"),
+ '$audurl' => t("Please enter an audio link/URL:"),
'$whereareu' => t('Where are you right now?'),
'$title' => t('Enter a title for this item')
));
@@ -795,9 +794,8 @@ function status_editor($a,$x, $notes_cid = 0) {
'$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$weblink' => t('Insert web link'),
- '$youtube' => t('Insert YouTube video'),
- '$video' => t('Insert Vorbis [.ogg] video'),
- '$audio' => t('Insert Vorbis [.ogg] audio'),
+ '$video' => t('Insert video link'),
+ '$audio' => t('Insert audio link'),
'$setloc' => t('Set your location'),
'$noloc' => t('Clear browser location'),
'$title' => t('Set title'),
diff --git a/include/items.php b/include/items.php
index 8360a42ec..4862ca578 100644
--- a/include/items.php
+++ b/include/items.php
@@ -414,11 +414,7 @@ function get_atom_elements($feed,$item) {
if((strpos($res['body'],'<') !== false) || (strpos($res['body'],'>') !== false)) {
- $res['body'] = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
- '[youtube]$1[/youtube]', $res['body']);
-
- $res['body'] = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?</iframe>#s',
- '[youtube]$1[/youtube]', $res['body']);
+ $res['body'] = html2bb_video($res['body']);
$res['body'] = oembed_html2bbcode($res['body']);
@@ -586,12 +582,7 @@ function get_atom_elements($feed,$item) {
$res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
- $body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
- '[youtube]$1[/youtube]', $body);
-
- $res['body'] = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?</iframe>#s',
- '[youtube]$1[/youtube]', $res['body']);
-
+ $body = html2bb_video($body);
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.DefinitionImpl', null);
@@ -629,11 +620,7 @@ function get_atom_elements($feed,$item) {
$res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
- $body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
- '[youtube]$1[/youtube]', $body);
-
- $res['body'] = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?</iframe>#s',
- '[youtube]$1[/youtube]', $res['body']);
+ $body = html2bb_video($body);
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.DefinitionImpl', null);
diff --git a/include/notifier.php b/include/notifier.php
index 90111600a..9dc524585 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -779,6 +779,12 @@ function notifier_run($argv, $argc){
}
+ if($normal_mode)
+ call_hooks('notifier_normal',$target_item);
+
+ call_hooks('notifier_end',$target_item);
+
+
return;
}
diff --git a/include/text.php b/include/text.php
index fd413b7d6..299410a63 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1003,3 +1003,37 @@ if (!function_exists('str_getcsv')) {
}
}
}
+
+function cleardiv() {
+ return '<div class="clear"></div>';
+}
+
+
+function bb_translate_video($s) {
+
+ $matches = null;
+ $r = preg_match_all("/\[video\](.*?)\[\/video\]/ism",$s,$matches,PREG_SET_ORDER);
+ if($r) {
+ foreach($matches as $mtch) {
+ if((stristr($mtch[1],'youtube')) || (stristr($mtch[1],'youtu.be')))
+ $s = str_replace($mtch[0],'[youtube]' . $mtch[1] . '[/youtube]',$s);
+ elseif(stristr($mtch[1],'vimeo'))
+ $s = str_replace($mtch[0],'[vimeo]' . $mtch[1] . '[/vimeo]',$s);
+ }
+ }
+ return $s;
+}
+
+function html2bb_video($s) {
+
+ $s = preg_replace('#<object[^>]+>(.*?)https+://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+)(.*?)</object>#ism',
+ '[youtube]$2[/youtube]', $s);
+
+ $s = preg_replace('#<iframe[^>](.*?)https+://www.youtube.com/embed/([A-Za-z0-9\-_=]+)(.*?)</iframe>#ism',
+ '[youtube]$2[/youtube]', $s);
+
+ $s = preg_replace('#<iframe[^>](.*?)https+://player.vimeo.com/video/([0-9]+)(.*?)</iframe>#ism',
+ '[vimeo]$2[/vimeo]', $s);
+
+ return $s;
+} \ No newline at end of file