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