<?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) {
$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
}
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);
$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']);