2012-06-26 01:01:32 -04: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 14:41:10 -04:00
|
|
|
|
2014-06-14 19:57:31 -04: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 17:35:29 -05:00
|
|
|
}
|
2011-07-18 22:17:16 -04: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 20:18:43 -04: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 16:56:34 -04: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 16:56:34 -04:00
|
|
|
}
|
|
|
|
|
2012-07-07 18:20:24 -04:00
|
|
|
function bb_extract_images($body) {
|
2018-02-04 18:44:42 -05:00
|
|
|
return BBCode::extractImagesFromItemBody($body);
|
2017-12-11 23:52:33 -05:00
|
|
|
}
|
2012-07-07 18:20:24 -04:00
|
|
|
|
|
|
|
function bb_replace_images($body, $images) {
|
2018-02-04 18:44:42 -05:00
|
|
|
return BBCode::interpolateSavedImagesIntoItemBody($body, $images);
|
2017-12-11 23:52:33 -05:00
|
|
|
}
|
2012-07-07 18:20:24 -04:00
|
|
|
|
2018-02-04 18:44:42 -05:00
|
|
|
function bb_ShareAttributes($share, $simplehtml) {
|
|
|
|
return BBCode::convertShare($share, $simplehtml);
|
2013-07-28 14:38:48 -04:00
|
|
|
}
|
|
|
|
|
2014-08-26 11:10:46 -04: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 09:23:10 -04:00
|
|
|
} else {
|
2018-02-04 18:44:42 -05:00
|
|
|
return Network::formatMention($profile, $username);
|
2014-02-22 09:42:34 -05:00
|
|
|
}
|
2014-02-11 17:42:06 -05:00
|
|
|
}
|
|
|
|
|
2014-02-22 09:42:34 -05:00
|
|
|
function bb_CleanPictureLinks($text) {
|
2018-02-04 18:44:42 -05:00
|
|
|
return BBCode::cleanPictureLinks($text);
|
2016-06-16 05:38:12 -04: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 23:52:49 -04:00
|
|
|
}
|
2016-02-22 17:20:59 -05:00
|
|
|
|
|
|
|
function remove_abstract($text) {
|
2018-02-04 18:44:42 -05:00
|
|
|
return BBCode::removeAbstract($text);
|
2016-02-22 17:20:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function fetch_abstract($text, $addon = "") {
|
2018-02-04 18:44:42 -05:00
|
|
|
return BBCode::getAbstract($text, $addon);
|
2016-02-22 17:20:59 -05:00
|
|
|
}
|