Update references to BBCode methods
- Resolve name conflicts with Util\Network
This commit is contained in:
parent
b4651870db
commit
010cf3b1e8
9 changed files with 56 additions and 54 deletions
|
@ -2,16 +2,18 @@
|
||||||
/**
|
/**
|
||||||
* @file include/acl_selectors.php
|
* @file include/acl_selectors.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
use Friendica\Content\Widget;
|
use Friendica\Content\Widget;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
use Friendica\Core\Network;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network as NetworkUtil;
|
||||||
|
|
||||||
require_once "mod/proxy.php";
|
require_once "mod/proxy.php";
|
||||||
|
|
||||||
|
@ -248,7 +250,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($privmail) {
|
if ($privmail) {
|
||||||
$trimmed = GetProfileUsername($rr['url'], $rr['name'], false);
|
$trimmed = Network::formatMention($rr['url'], $rr['name']);
|
||||||
} else {
|
} else {
|
||||||
$trimmed = mb_substr($rr['name'],0,20);
|
$trimmed = mb_substr($rr['name'],0,20);
|
||||||
}
|
}
|
||||||
|
@ -734,7 +736,7 @@ function navbar_complete(App $a) {
|
||||||
if (! $localsearch) {
|
if (! $localsearch) {
|
||||||
$p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
|
$p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
|
||||||
|
|
||||||
$x = Network::curl(get_server() . '/lsearch?f=' . $p . '&search=' . urlencode($search));
|
$x = NetworkUtil::curl(get_server() . '/lsearch?f=' . $p . '&search=' . urlencode($search));
|
||||||
if ($x['success']) {
|
if ($x['success']) {
|
||||||
$j = json_decode($x['body'],true);
|
$j = json_decode($x['body'],true);
|
||||||
if ($j && isset($j['results'])) {
|
if ($j && isset($j['results'])) {
|
||||||
|
|
|
@ -2753,7 +2753,7 @@ function api_get_entitities(&$text, $bbcode)
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$bbcode = bb_CleanPictureLinks($bbcode);
|
$bbcode = BBCode::cleanPictureLinks($bbcode);
|
||||||
|
|
||||||
// Change pure links in text to bbcode uris
|
// Change pure links in text to bbcode uris
|
||||||
$bbcode = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2]$2[/url]', $bbcode);
|
$bbcode = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2]$2[/url]', $bbcode);
|
||||||
|
@ -5173,7 +5173,7 @@ function api_clean_plain_items($Text)
|
||||||
{
|
{
|
||||||
$include_entities = strtolower(x($_REQUEST, 'include_entities') ? $_REQUEST['include_entities'] : "false");
|
$include_entities = strtolower(x($_REQUEST, 'include_entities') ? $_REQUEST['include_entities'] : "false");
|
||||||
|
|
||||||
$Text = bb_CleanPictureLinks($Text);
|
$Text = BBCode::cleanPictureLinks($Text);
|
||||||
$URLSearchString = "^\[\]";
|
$URLSearchString = "^\[\]";
|
||||||
|
|
||||||
$Text = preg_replace("/([!#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text);
|
$Text = preg_replace("/([!#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text);
|
||||||
|
|
|
@ -76,10 +76,10 @@ function diaspora2bb($s) {
|
||||||
$s = preg_replace('/([^\]=]|^)(https?\:\/\/)([a-zA-Z0-9:\/\-?&;.=_~#%$!+,@]+(?<!,))/ism', '$1[url=$2$3]$2$3[/url]', $s);
|
$s = preg_replace('/([^\]=]|^)(https?\:\/\/)([a-zA-Z0-9:\/\-?&;.=_~#%$!+,@]+(?<!,))/ism', '$1[url=$2$3]$2$3[/url]', $s);
|
||||||
|
|
||||||
//$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3$4]$2$3$4[/url]',$s);
|
//$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3$4]$2$3$4[/url]',$s);
|
||||||
$s = bb_tag_preg_replace('/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism', '[youtube]$2[/youtube]', 'url', $s);
|
$s = BBCode::pregReplaceInTag('/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism', '[youtube]$2[/youtube]', 'url', $s);
|
||||||
$s = bb_tag_preg_replace('/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism' , '[youtube]$1[/youtube]', 'url', $s);
|
$s = BBCode::pregReplaceInTag('/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism' , '[youtube]$1[/youtube]', 'url', $s);
|
||||||
$s = bb_tag_preg_replace('/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism' , '[vimeo]$2[/vimeo]' , 'url', $s);
|
$s = BBCode::pregReplaceInTag('/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism' , '[vimeo]$2[/vimeo]' , 'url', $s);
|
||||||
$s = bb_tag_preg_replace('/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism' , '[vimeo]$1[/vimeo]' , 'url', $s);
|
$s = BBCode::pregReplaceInTag('/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism' , '[vimeo]$1[/vimeo]' , 'url', $s);
|
||||||
|
|
||||||
// remove duplicate adjacent code tags
|
// remove duplicate adjacent code tags
|
||||||
$s = preg_replace('/(\[code\])+(.*?)(\[\/code\])+/ism', '[code]$2[/code]', $s);
|
$s = preg_replace('/(\[code\])+(.*?)(\[\/code\])+/ism', '[code]$2[/code]', $s);
|
||||||
|
@ -130,7 +130,7 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) {
|
||||||
|
|
||||||
// Since Diaspora is creating a summary for links, this function removes them before posting
|
// Since Diaspora is creating a summary for links, this function removes them before posting
|
||||||
if ($fordiaspora) {
|
if ($fordiaspora) {
|
||||||
$Text = bb_remove_share_information($Text);
|
$Text = BBCode::removeShareInformation($Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Content\ContactSelector;
|
use Friendica\Content\ContactSelector;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
@ -72,7 +73,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
|
||||||
$newbody = '';
|
$newbody = '';
|
||||||
|
|
||||||
$cnt = 1;
|
$cnt = 1;
|
||||||
$pos = get_bb_tag_pos($origbody, 'url', 1);
|
$pos = BBCode::getTagPosition($origbody, 'url', 0);
|
||||||
while ($pos !== false && $cnt < 1000) {
|
while ($pos !== false && $cnt < 1000) {
|
||||||
|
|
||||||
$search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is';
|
$search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is';
|
||||||
|
@ -90,7 +91,8 @@ function item_redir_and_replace_images($body, $images, $cid) {
|
||||||
$newbody .= $subject;
|
$newbody .= $subject;
|
||||||
|
|
||||||
$cnt++;
|
$cnt++;
|
||||||
$pos = get_bb_tag_pos($origbody, 'url', 1);
|
// Isn't this supposed to use $cnt value for $occurrences? - @MrPetovan
|
||||||
|
$pos = BBCode::getTagPosition($origbody, 'url', 0);
|
||||||
}
|
}
|
||||||
$newbody .= $origbody;
|
$newbody .= $origbody;
|
||||||
|
|
||||||
|
@ -347,7 +349,7 @@ function localize_item(&$item) {
|
||||||
$photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is";
|
$photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is";
|
||||||
if (preg_match($photo_pattern, $item['body'])) {
|
if (preg_match($photo_pattern, $item['body'])) {
|
||||||
$photo_replace = '[url=' . Profile::zrl('$1' . '/photos/' . '$2' . '/image/' . '$3' ,true) . '][img' . '$4' . ']h' . '$5' . '[/img][/url]';
|
$photo_replace = '[url=' . Profile::zrl('$1' . '/photos/' . '$2' . '/image/' . '$3' ,true) . '][img' . '$4' . ']h' . '$5' . '[/img][/url]';
|
||||||
$item['body'] = bb_tag_preg_replace($photo_pattern, $photo_replace, 'url', $item['body']);
|
$item['body'] = BBCode::pregReplaceInTag($photo_pattern, $photo_replace, 'url', $item['body']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add sparkle links to appropriate permalinks
|
// add sparkle links to appropriate permalinks
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file mod/display.php
|
* @file mod/display.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
use Friendica\Core\Network;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
@ -171,7 +173,7 @@ function display_fetchauthor($a, $item) {
|
||||||
$profiledata["photo"] = $matches[1];
|
$profiledata["photo"] = $matches[1];
|
||||||
}
|
}
|
||||||
$profiledata["nickname"] = $profiledata["name"];
|
$profiledata["nickname"] = $profiledata["name"];
|
||||||
$profiledata["network"] = GetProfileUsername($profiledata["url"], "", false, true);
|
$profiledata["network"] = Network::matchByProfileUrl($profiledata["url"]);
|
||||||
|
|
||||||
$profiledata["address"] = "";
|
$profiledata["address"] = "";
|
||||||
$profiledata["about"] = "";
|
$profiledata["about"] = "";
|
||||||
|
|
|
@ -13,12 +13,13 @@ use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Cache;
|
use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
use Friendica\Core\Network;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\Map;
|
use Friendica\Util\Map;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network as NetworkUtil;
|
||||||
use Friendica\Util\ParseUrl;
|
use Friendica\Util\ParseUrl;
|
||||||
|
|
||||||
require_once "include/bbcode.php";
|
require_once "include/bbcode.php";
|
||||||
|
@ -352,7 +353,7 @@ class BBCode
|
||||||
$body = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url]$2[/url]', $body);
|
$body = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url]$2[/url]', $body);
|
||||||
|
|
||||||
// Remove the abstract
|
// Remove the abstract
|
||||||
$body = remove_abstract($body);
|
$body = self::removeAbstract($body);
|
||||||
|
|
||||||
// At first look at data that is attached via "type-..." stuff
|
// At first look at data that is attached via "type-..." stuff
|
||||||
// This will hopefully replaced with a dedicated bbcode later
|
// This will hopefully replaced with a dedicated bbcode later
|
||||||
|
@ -369,8 +370,8 @@ class BBCode
|
||||||
|
|
||||||
// Fetch the abstract from the given target network
|
// Fetch the abstract from the given target network
|
||||||
if ($target_network != "") {
|
if ($target_network != "") {
|
||||||
$default_abstract = fetch_abstract($b["body"]);
|
$default_abstract = self::getAbstract($b["body"]);
|
||||||
$abstract = fetch_abstract($b["body"], $target_network);
|
$abstract = self::getAbstract($b["body"], $target_network);
|
||||||
|
|
||||||
// If we post to a network with no limit we only fetch
|
// If we post to a network with no limit we only fetch
|
||||||
// an abstract exactly for this network
|
// an abstract exactly for this network
|
||||||
|
@ -380,18 +381,18 @@ class BBCode
|
||||||
} else {// Try to guess the correct target network
|
} else {// Try to guess the correct target network
|
||||||
switch ($htmlmode) {
|
switch ($htmlmode) {
|
||||||
case 8:
|
case 8:
|
||||||
$abstract = fetch_abstract($b["body"], NETWORK_TWITTER);
|
$abstract = self::getAbstract($b["body"], NETWORK_TWITTER);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
$abstract = fetch_abstract($b["body"], NETWORK_STATUSNET);
|
$abstract = self::getAbstract($b["body"], NETWORK_STATUSNET);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
$abstract = fetch_abstract($b["body"], NETWORK_APPNET);
|
$abstract = self::getAbstract($b["body"], NETWORK_APPNET);
|
||||||
break;
|
break;
|
||||||
default: // We don't know the exact target.
|
default: // We don't know the exact target.
|
||||||
// We fetch an abstract since there is a posting limit.
|
// We fetch an abstract since there is a posting limit.
|
||||||
if ($limit > 0) {
|
if ($limit > 0) {
|
||||||
$abstract = fetch_abstract($b["body"]);
|
$abstract = self::getAbstract($b["body"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,7 +519,7 @@ class BBCode
|
||||||
} else {
|
} else {
|
||||||
$scaled = $mtch[1];
|
$scaled = $mtch[1];
|
||||||
}
|
}
|
||||||
$i = Network::fetchUrl($scaled);
|
$i = NetworkUtil::fetchUrl($scaled);
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
return $srctext;
|
return $srctext;
|
||||||
}
|
}
|
||||||
|
@ -924,9 +925,9 @@ class BBCode
|
||||||
*/
|
*/
|
||||||
public static function pregReplaceInTag($pattern, $replace, $name, $text)
|
public static function pregReplaceInTag($pattern, $replace, $name, $text)
|
||||||
{
|
{
|
||||||
$occurence = 1;
|
$occurrences = 0;
|
||||||
$pos = get_bb_tag_pos($text, $name, $occurence);
|
$pos = self::getTagPosition($text, $name, $occurrences);
|
||||||
while ($pos !== false && $occurence < 1000) {
|
while ($pos !== false && $occurrences++ < 1000) {
|
||||||
$start = substr($text, 0, $pos['start']['open']);
|
$start = substr($text, 0, $pos['start']['open']);
|
||||||
$subject = substr($text, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']);
|
$subject = substr($text, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']);
|
||||||
$end = substr($text, $pos['end']['close']);
|
$end = substr($text, $pos['end']['close']);
|
||||||
|
@ -937,14 +938,13 @@ class BBCode
|
||||||
$subject = preg_replace($pattern, $replace, $subject);
|
$subject = preg_replace($pattern, $replace, $subject);
|
||||||
$text = $start . $subject . $end;
|
$text = $start . $subject . $end;
|
||||||
|
|
||||||
$occurence++;
|
$pos = self::getTagPosition($text, $name, $occurrences);
|
||||||
$pos = get_bb_tag_pos($text, $name, $occurence);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function extractImagesFromItemBody($body)
|
private static function extractImagesFromItemBody($body)
|
||||||
{
|
{
|
||||||
$saved_image = [];
|
$saved_image = [];
|
||||||
$orig_body = $body;
|
$orig_body = $body;
|
||||||
|
@ -985,7 +985,7 @@ class BBCode
|
||||||
return ['body' => $new_body, 'images' => $saved_image];
|
return ['body' => $new_body, 'images' => $saved_image];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function interpolateSavedImagesIntoItemBody($body, array $images)
|
private static function interpolateSavedImagesIntoItemBody($body, array $images)
|
||||||
{
|
{
|
||||||
$newbody = $body;
|
$newbody = $body;
|
||||||
|
|
||||||
|
@ -1012,7 +1012,7 @@ class BBCode
|
||||||
* @param bool|int $simplehtml
|
* @param bool|int $simplehtml
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function convertShare($share, $simplehtml)
|
private static function convertShare($share, $simplehtml)
|
||||||
{
|
{
|
||||||
$attributes = $share[2];
|
$attributes = $share[2];
|
||||||
|
|
||||||
|
@ -1082,13 +1082,13 @@ class BBCode
|
||||||
if (x($data, "name") && x($data, "addr")) {
|
if (x($data, "name") && x($data, "addr")) {
|
||||||
$userid_compact = $data["name"] . " (" . $data["addr"] . ")";
|
$userid_compact = $data["name"] . " (" . $data["addr"] . ")";
|
||||||
} else {
|
} else {
|
||||||
$userid_compact = GetProfileUsername($profile, $author, true);
|
$userid_compact = Network::getAddrFromProfileUrl($profile, $author);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($data, "addr")) {
|
if (x($data, "addr")) {
|
||||||
$userid = $data["addr"];
|
$userid = $data["addr"];
|
||||||
} else {
|
} else {
|
||||||
$userid = GetProfileUsername($profile, $author, false);
|
$userid = Network::formatMention($profile, $author);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($data, "name")) {
|
if (x($data, "name")) {
|
||||||
|
@ -1378,7 +1378,7 @@ class BBCode
|
||||||
$text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'self::escapeNoparseCallback', $text);
|
$text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'self::escapeNoparseCallback', $text);
|
||||||
|
|
||||||
// Remove the abstract element. It is a non visible element.
|
// Remove the abstract element. It is a non visible element.
|
||||||
$text = remove_abstract($text);
|
$text = self::removeAbstract($text);
|
||||||
|
|
||||||
// Move all spaces out of the tags
|
// Move all spaces out of the tags
|
||||||
$text = preg_replace("/\[(\w*)\](\s*)/ism", '$2[$1]', $text);
|
$text = preg_replace("/\[(\w*)\](\s*)/ism", '$2[$1]', $text);
|
||||||
|
@ -1388,7 +1388,7 @@ class BBCode
|
||||||
// large data sizes. Stash them away while we do bbcode conversion, and then put them back
|
// large data sizes. Stash them away while we do bbcode conversion, and then put them back
|
||||||
// in after we've done all the regex matching. We cannot use any preg functions to do this.
|
// in after we've done all the regex matching. We cannot use any preg functions to do this.
|
||||||
|
|
||||||
$extracted = bb_extract_images($text);
|
$extracted = self::extractImagesFromItemBody($text);
|
||||||
$text = $extracted['body'];
|
$text = $extracted['body'];
|
||||||
$saved_image = $extracted['images'];
|
$saved_image = $extracted['images'];
|
||||||
|
|
||||||
|
@ -1767,7 +1767,7 @@ class BBCode
|
||||||
// Shared content
|
// Shared content
|
||||||
$text = preg_replace_callback("/(.*?)\[share(.*?)\](.*?)\[\/share\]/ism",
|
$text = preg_replace_callback("/(.*?)\[share(.*?)\](.*?)\[\/share\]/ism",
|
||||||
function ($match) use ($simple_html) {
|
function ($match) use ($simple_html) {
|
||||||
return bb_ShareAttributes($match, $simple_html);
|
return self::convertShare($match, $simple_html);
|
||||||
}, $text);
|
}, $text);
|
||||||
|
|
||||||
$text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . L10n::t('Encrypted content') . '" /><br />', $text);
|
$text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . L10n::t('Encrypted content') . '" /><br />', $text);
|
||||||
|
@ -1902,7 +1902,7 @@ class BBCode
|
||||||
$text = preg_replace($regex, '<$1$2="javascript:void(0)"$4 data-original-href="$3" class="invalid-href" title="' . L10n::t('Invalid link protocol') . '">', $text);
|
$text = preg_replace($regex, '<$1$2="javascript:void(0)"$4 data-original-href="$3" class="invalid-href" title="' . L10n::t('Invalid link protocol') . '">', $text);
|
||||||
|
|
||||||
if ($saved_image) {
|
if ($saved_image) {
|
||||||
$text = bb_replace_images($text, $saved_image);
|
$text = self::interpolateSavedImagesIntoItemBody($text, $saved_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up the HTML by loading and saving the HTML with the DOM.
|
// Clean up the HTML by loading and saving the HTML with the DOM.
|
||||||
|
@ -1959,7 +1959,7 @@ class BBCode
|
||||||
* @param string $addon The addon for which the abstract is meant for
|
* @param string $addon The addon for which the abstract is meant for
|
||||||
* @return string The abstract
|
* @return string The abstract
|
||||||
*/
|
*/
|
||||||
public static function getAbstract($text, $addon = "")
|
private static function getAbstract($text, $addon = "")
|
||||||
{
|
{
|
||||||
$abstract = "";
|
$abstract = "";
|
||||||
$abstracts = [];
|
$abstracts = [];
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Friendica\Protocol;
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Content\OEmbed;
|
use Friendica\Content\OEmbed;
|
||||||
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
@ -29,8 +30,6 @@ use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
use Friendica\Content\Text\BBCode;
|
|
||||||
|
|
||||||
use dba;
|
use dba;
|
||||||
use DOMDocument;
|
use DOMDocument;
|
||||||
use DOMXPath;
|
use DOMXPath;
|
||||||
|
@ -931,7 +930,7 @@ class DFRN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the abstract element. It is only locally important.
|
// Remove the abstract element. It is only locally important.
|
||||||
$body = remove_abstract($body);
|
$body = BBCode::removeAbstract($body);
|
||||||
|
|
||||||
if ($type == 'html') {
|
if ($type == 'html') {
|
||||||
$htmlbody = $body;
|
$htmlbody = $body;
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
* Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus>
|
* Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\Content\Text\Plaintext;
|
||||||
use Friendica\Content\Widget;
|
use Friendica\Content\Widget;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
@ -15,7 +17,6 @@ use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Object\Image;
|
|
||||||
|
|
||||||
$frio = "view/theme/frio";
|
$frio = "view/theme/frio";
|
||||||
|
|
||||||
|
@ -90,10 +91,8 @@ function frio_uninstall()
|
||||||
*/
|
*/
|
||||||
function frio_item_photo_links(App $a, &$body_info)
|
function frio_item_photo_links(App $a, &$body_info)
|
||||||
{
|
{
|
||||||
$phototypes = Image::supportedTypes();
|
$occurence = 0;
|
||||||
$occurence = 1;
|
$p = Plaintext::getBoundariesPosition($body_info['html'], "<a", ">");
|
||||||
$p = bb_find_open_close($body_info['html'], "<a", ">");
|
|
||||||
|
|
||||||
while ($p !== false && ($occurence++ < 500)) {
|
while ($p !== false && ($occurence++ < 500)) {
|
||||||
$link = substr($body_info['html'], $p['start'], $p['end'] - $p['start']);
|
$link = substr($body_info['html'], $p['start'], $p['end'] - $p['start']);
|
||||||
$matches = [];
|
$matches = [];
|
||||||
|
@ -112,7 +111,7 @@ function frio_item_photo_links(App $a, &$body_info)
|
||||||
$body_info['html'] = str_replace($link, $newlink, $body_info['html']);
|
$body_info['html'] = str_replace($link, $newlink, $body_info['html']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = bb_find_open_close($body_info['html'], "<a", ">", $occurence);
|
$p = Plaintext::getBoundariesPosition($body_info['html'], "<a", ">", $occurence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\Content\Text\Plaintext;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Object\Image;
|
|
||||||
|
|
||||||
function frost_init(App $a) {
|
function frost_init(App $a) {
|
||||||
$a->videowidth = 400;
|
$a->videowidth = 400;
|
||||||
|
@ -49,10 +49,8 @@ function frost_uninstall() {
|
||||||
|
|
||||||
function frost_item_photo_links(App $a, &$body_info)
|
function frost_item_photo_links(App $a, &$body_info)
|
||||||
{
|
{
|
||||||
$phototypes = Image::supportedTypes();
|
$occurence = 0;
|
||||||
|
$p = Plaintext::getBoundariesPosition($body_info['html'], '<a', '>');
|
||||||
$occurence = 1;
|
|
||||||
$p = bb_find_open_close($body_info['html'], "<a", ">");
|
|
||||||
while($p !== false && ($occurence++ < 500)) {
|
while($p !== false && ($occurence++ < 500)) {
|
||||||
$link = substr($body_info['html'], $p['start'], $p['end'] - $p['start']);
|
$link = substr($body_info['html'], $p['start'], $p['end'] - $p['start']);
|
||||||
|
|
||||||
|
@ -73,7 +71,7 @@ function frost_item_photo_links(App $a, &$body_info)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = bb_find_open_close($body_info['html'], "<a", ">", $occurence);
|
$p = Plaintext::getBoundariesPosition($body_info['html'], '<a', '>', $occurence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue