Merge branch 'develop' into rewrites/coding-convention-split2-1-2
authorRoland Häder <Quix0r@users.noreply.github.com>
Sat, 8 Apr 2017 16:45:59 +0000 (18:45 +0200)
committerGitHub <noreply@github.com>
Sat, 8 Apr 2017 16:45:59 +0000 (18:45 +0200)
1  2 
include/bb2diaspora.php
include/bbcode.php

Simple merge
@@@ -1,20 -1,19 +1,20 @@@
  <?php
  use \Friendica\Core\Config;
  
- require_once("include/oembed.php");
- require_once('include/event.php');
- require_once('include/map.php');
- require_once('mod/proxy.php');
- require_once('include/Contact.php');
- require_once('include/plaintext.php');
+ require_once 'include/oembed.php';
+ require_once 'include/event.php';
+ require_once 'include/map.php';
+ require_once 'mod/proxy.php';
+ require_once 'include/Contact.php';
+ require_once 'include/plaintext.php';
  
  function bb_PictureCacheExt($matches) {
 -      if (strpos($matches[3], "data:image/") === 0)
 +      if (strpos($matches[3], "data:image/") === 0) {
                return ($matches[0]);
 +      }
  
        $matches[3] = proxy_url($matches[3]);
 -      return "[img=".$matches[1]."x".$matches[2]."]".$matches[3]."[/img]";
 +      return "[img=" . $matches[1] . "x" . $matches[2] . "]" . $matches[3] . "[/img]";
  }
  
  function bb_PictureCache($matches) {
@@@ -186,24 -166,19 +179,23 @@@ function tryoembed($match) 
        $url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
                                array("https://www.youtube.com/", "https://player.vimeo.com/"), $url);
  
 -
        $o = oembed_fetch_url($url);
  
 -      if (!is_object($o))
 +      if (!is_object($o)) {
                return $match[0];
 +      }
  
 -      if (isset($match[2]))
 +      if (isset($match[2])) {
                $o->title = $match[2];
 +      }
  
 -      if ($o->type=="error") return $match[0];
 +      if ($o->type == "error") {
 +              return $match[0];
 +      }
  
        $html = oembed_format_object($o);
 +
        return $html;
  }
  
  // [noparse][i]italic[/i][/noparse] turns into
@@@ -230,21 -205,18 +222,20 @@@ function bb_unspacefy_and_trim($st) 
  }
  
  function bb_find_open_close($s, $open, $close, $occurence = 1) {
--
-       if ($occurence < 1) {
 -      if($occurence < 1)
--              $occurence = 1;
-       }
++  if ($occurence < 1) {
++        $occurence = 1;
++  }
  
        $start_pos = -1;
 -      for($i = 1; $i <= $occurence; $i++) {
 -              if( $start_pos !== false)
 +      for ($i = 1; $i <= $occurence; $i++) {
-               if ($start_pos !== false) {
++              if ( $start_pos !== false) {
                        $start_pos = strpos($s, $open, $start_pos + 1);
 +              }
        }
  
 -      if( $start_pos === false)
 +      if ($start_pos === false) {
                return false;
 +      }
  
        $end_pos = strpos($s, $close, $start_pos);
  
  }
  
  function get_bb_tag_pos($s, $name, $occurence = 1) {
--
 -      if($occurence < 1)
 +      if ($occurence < 1) {
                $occurence = 1;
-       }
++  }
  
        $start_open = -1;
 -      for($i = 1; $i <= $occurence; $i++) {
 -              if( $start_open !== false)
 +      for ($i = 1; $i <= $occurence; $i++) {
-               if ($start_open !== false) {
++              if ( $start_open !== false) {
                        $start_open = strpos($s, '[' . $name, $start_open + 1); // allow [name= type tags
 +              }
        }
  
 -      if( $start_open === false)
 +      if ( $start_open === false) {
                return false;
 +      }
  
        $start_equal = strpos($s, '=', $start_open);
        $start_close = strpos($s, ']', $start_open);
@@@ -313,8 -269,8 +303,7 @@@ function bb_tag_preg_replace($pattern, 
  
        $occurence = 1;
        $pos = get_bb_tag_pos($string, $name, $occurence);
 -      while($pos !== false && $occurence < 1000) {
 -
 +      while ($pos !== false && $occurence < 1000) {
                $start = substr($string, 0, $pos['start']['open']);
                $subject = substr($string, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']);
                $end = substr($string, $pos['end']['close']);