mirror of
https://github.com/friendica/friendica
synced 2025-04-24 00:30:11 +00:00
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
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Network;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Network as NetworkUtil;
|
||||
|
||||
require_once "mod/proxy.php";
|
||||
|
||||
|
@ -248,7 +250,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
|
|||
}
|
||||
|
||||
if ($privmail) {
|
||||
$trimmed = GetProfileUsername($rr['url'], $rr['name'], false);
|
||||
$trimmed = Network::formatMention($rr['url'], $rr['name']);
|
||||
} else {
|
||||
$trimmed = mb_substr($rr['name'],0,20);
|
||||
}
|
||||
|
@ -734,7 +736,7 @@ function navbar_complete(App $a) {
|
|||
if (! $localsearch) {
|
||||
$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']) {
|
||||
$j = json_decode($x['body'],true);
|
||||
if ($j && isset($j['results'])) {
|
||||
|
|
|
@ -2753,7 +2753,7 @@ function api_get_entitities(&$text, $bbcode)
|
|||
return [];
|
||||
}
|
||||
|
||||
$bbcode = bb_CleanPictureLinks($bbcode);
|
||||
$bbcode = BBCode::cleanPictureLinks($bbcode);
|
||||
|
||||
// Change pure links in text to bbcode uris
|
||||
$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");
|
||||
|
||||
$Text = bb_CleanPictureLinks($Text);
|
||||
$Text = BBCode::cleanPictureLinks($Text);
|
||||
$URLSearchString = "^\[\]";
|
||||
|
||||
$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?\:\/\/)(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 = bb_tag_preg_replace('/\[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 = bb_tag_preg_replace('/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism' , '[vimeo]$1[/vimeo]' , 'url', $s);
|
||||
$s = BBCode::pregReplaceInTag('/\[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]$1[/youtube]', 'url', $s);
|
||||
$s = BBCode::pregReplaceInTag('/\[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]$1[/vimeo]' , 'url', $s);
|
||||
|
||||
// remove duplicate adjacent code tags
|
||||
$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
|
||||
if ($fordiaspora) {
|
||||
$Text = bb_remove_share_information($Text);
|
||||
$Text = BBCode::removeShareInformation($Text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -72,7 +73,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
|
|||
$newbody = '';
|
||||
|
||||
$cnt = 1;
|
||||
$pos = get_bb_tag_pos($origbody, 'url', 1);
|
||||
$pos = BBCode::getTagPosition($origbody, 'url', 0);
|
||||
while ($pos !== false && $cnt < 1000) {
|
||||
|
||||
$search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is';
|
||||
|
@ -90,7 +91,8 @@ function item_redir_and_replace_images($body, $images, $cid) {
|
|||
$newbody .= $subject;
|
||||
|
||||
$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;
|
||||
|
||||
|
@ -347,7 +349,7 @@ function localize_item(&$item) {
|
|||
$photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is";
|
||||
if (preg_match($photo_pattern, $item['body'])) {
|
||||
$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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue