]> git.mxchange.org Git - friendica.git/commitdiff
home_init hook
authorfriendica <info@friendica.com>
Thu, 15 Dec 2011 09:08:19 +0000 (01:08 -0800)
committerfriendica <info@friendica.com>
Thu, 15 Dec 2011 09:08:19 +0000 (01:08 -0800)
include/bbcode.php
mod/home.php

index 15b2ebb0a55c185e698476b2a07845cd8a91e634..a8e3bed7011ee87e01b23c9083d19b79af8c0e6a 100644 (file)
@@ -11,6 +11,7 @@ function stripcode_br_cb($s) {
 
 function tryoembed($match){
        $url = ((count($match)==2)?$match[1]:$match[2]);
+       logger('tryoembed: $url');
        
        $o = oembed_fetch_url($url);
 
@@ -180,22 +181,18 @@ function bbcode($Text,$preserve_nl = false) {
        $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<iframe src="$1" width="425" height="350"><a href="$1">$1</a></iframe>', $Text);
          
 
-       /*if (get_pconfig(local_user(), 'oembed', 'use_for_youtube' )==1){
-               // use oembed for youtube links
-               $Text = preg_replace("/\[youtube\]/",'[embed]',$Text); 
-               $Text = preg_replace("/\[\/youtube\]/",'[/embed]',$Text); 
-       } else {*/
-               // Youtube extensions
-        $Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);        
-        $Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism",'tryoembed',$Text); 
+       // Youtube extensions
+       $Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);        
+       $Text = preg_replace_callback("/\[youtube\](www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);        
+       $Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism",'tryoembed',$Text); 
         
-        $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); 
-        $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); 
-        $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); 
+       $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); 
+       $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); 
+       $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); 
                
         
-               $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("/\[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_callback("/\[vimeo\](https?:\/\/player.vimeo.com\/video\/[0-9]+).*?\[\/vimeo\]/ism",'tryoembed',$Text); 
        $Text = preg_replace_callback("/\[vimeo\](https?:\/\/vimeo.com\/[0-9]+).*?\[\/vimeo\]/ism",'tryoembed',$Text); 
index 225bd294d2fbcecce3a716060b6c8708e3f04031..8db5b26ac9d88e6d9d385384f8336fc6890c8430 100644 (file)
@@ -3,6 +3,8 @@
 if(! function_exists('home_init')) {
 function home_init(&$a) {
 
+       call_hooks('home_init',array());
+
        if(local_user() && ($a->user['nickname']))
                goaway( $a->get_baseurl() . "/profile/" . $a->user['nickname'] );