2012-06-26 05:01:32 +00:00
|
|
|
<?php
|
2018-01-22 19:08:58 +00:00
|
|
|
/**
|
|
|
|
* @file include/bbcode.php
|
|
|
|
*/
|
2018-02-04 23:44:42 +00:00
|
|
|
|
2018-01-27 01:01:32 +00:00
|
|
|
use Friendica\Content\Text\BBCode;
|
2018-02-04 23:44:42 +00:00
|
|
|
use Friendica\Content\Text\Plaintext;
|
|
|
|
use Friendica\Core\Network;
|
2016-12-05 02:33:29 +00:00
|
|
|
|
2017-04-07 03:43:55 +00:00
|
|
|
require_once 'include/event.php';
|
|
|
|
require_once 'mod/proxy.php';
|
2015-05-15 18:41:10 +00:00
|
|
|
|
2014-06-14 23:57:31 +00:00
|
|
|
function bb_remove_share_information($Text, $plaintext = false, $nolink = false) {
|
2018-02-04 23:44:42 +00:00
|
|
|
return BBCode::removeShareInformation($Text, $plaintext, $nolink);
|
2012-02-12 22:35:29 +00:00
|
|
|
}
|
2011-07-19 02:17:16 +00:00
|
|
|
|
2017-04-07 03:43:55 +00:00
|
|
|
function bb_find_open_close($s, $open, $close, $occurence = 1) {
|
2018-02-04 23:44:42 +00:00
|
|
|
return Plaintext::getBoundariesPosition($s, $open, $close, $occurence - 1);
|
2012-08-27 00:18:43 +00:00
|
|
|
}
|
|
|
|
|
2017-04-07 03:43:55 +00:00
|
|
|
function get_bb_tag_pos($s, $name, $occurence = 1) {
|
2018-02-04 23:44:42 +00:00
|
|
|
return BBCode::getTagPosition($s, $name, $occurence - 1);
|
2012-08-26 20:56:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function bb_tag_preg_replace($pattern, $replace, $name, $s) {
|
2018-02-04 23:44:42 +00:00
|
|
|
return BBCode::pregReplaceInTag($pattern, $replace, $name, $s);
|
2012-08-26 20:56:34 +00:00
|
|
|
}
|
|
|
|
|
2012-07-07 22:20:24 +00:00
|
|
|
function bb_extract_images($body) {
|
2018-02-04 23:44:42 +00:00
|
|
|
return BBCode::extractImagesFromItemBody($body);
|
2017-12-12 04:52:33 +00:00
|
|
|
}
|
2012-07-07 22:20:24 +00:00
|
|
|
|
|
|
|
function bb_replace_images($body, $images) {
|
2018-02-04 23:44:42 +00:00
|
|
|
return BBCode::interpolateSavedImagesIntoItemBody($body, $images);
|
2017-12-12 04:52:33 +00:00
|
|
|
}
|
2012-07-07 22:20:24 +00:00
|
|
|
|
2018-02-04 23:44:42 +00:00
|
|
|
function bb_ShareAttributes($share, $simplehtml) {
|
|
|
|
return BBCode::convertShare($share, $simplehtml);
|
2013-07-28 18:38:48 +00:00
|
|
|
}
|
|
|
|
|
2014-08-26 15:10:46 +00:00
|
|
|
function GetProfileUsername($profile, $username, $compact = false, $getnetwork = false) {
|
2018-02-04 23:44:42 +00:00
|
|
|
if ($getnetwork) {
|
|
|
|
return Network::matchByProfileUrl($profile);
|
|
|
|
} elseif ($compact) {
|
|
|
|
return Network::getAddrFromProfileUrl($profile);
|
2017-04-14 13:23:10 +00:00
|
|
|
} else {
|
2018-02-04 23:44:42 +00:00
|
|
|
return Network::formatMention($profile, $username);
|
2014-02-22 14:42:34 +00:00
|
|
|
}
|
2014-02-11 22:42:06 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 14:42:34 +00:00
|
|
|
function bb_CleanPictureLinks($text) {
|
2018-02-04 23:44:42 +00:00
|
|
|
return BBCode::cleanPictureLinks($text);
|
2016-06-16 09:38:12 +00:00
|
|
|
}
|
|
|
|
|
2018-01-07 15:01:41 +00:00
|
|
|
function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = false, $forplaintext = false)
|
|
|
|
{
|
2018-02-04 23:44:42 +00:00
|
|
|
return BBCode::convert($Text, $preserve_nl, $tryoembed, $simplehtml, $forplaintext);
|
2010-08-20 03:52:49 +00:00
|
|
|
}
|
2016-02-22 22:20:59 +00:00
|
|
|
|
|
|
|
function remove_abstract($text) {
|
2018-02-04 23:44:42 +00:00
|
|
|
return BBCode::removeAbstract($text);
|
2016-02-22 22:20:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function fetch_abstract($text, $addon = "") {
|
2018-02-04 23:44:42 +00:00
|
|
|
return BBCode::getAbstract($text, $addon);
|
2016-02-22 22:20:59 +00:00
|
|
|
}
|