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