use Friendica\App;
use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
+use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Config;
require_once 'mod/wall_upload.php';
require_once 'mod/proxy.php';
require_once 'include/like.php';
-require_once 'include/plaintext.php';
define('API_METHOD_ANY', '*');
define('API_METHOD_GET', 'GET');
*/
function api_clean_attachments($body)
{
- $data = get_attachment_data($body);
+ $data = Plaintext::getAttachmentData($body);
if (!$data) {
return $body;
use Friendica\App;
use Friendica\Content\Smilies;
use Friendica\Content\OEmbed;
+use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\L10n;
require_once 'include/event.php';
require_once 'mod/proxy.php';
-require_once 'include/plaintext.php';
function bb_PictureCacheExt($matches) {
if (strpos($matches[3], "data:image/") === 0) {
*/
function bb_attachment($return, $simplehtml = false, $tryoembed = true)
{
- $data = get_attachment_data($return);
+ $data = Plaintext::getAttachmentData($return);
if (!$data) {
return $return;
}
function bb_remove_share_information($Text, $plaintext = false, $nolink = false) {
- $data = get_attachment_data($Text);
+ $data = Plaintext::getAttachmentData($Text);
if (!$data) {
return $Text;
* information.
*/
use Friendica\App;
+use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
// embedded bookmark or attachment in post? set bookmark flag
$bookmark = 0;
- $data = get_attachment_data($body);
+ $data = Plaintext::getAttachmentData($body);
if (preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data["type"])) {
$objecttype = ACTIVITY_OBJ_BOOKMARK;
$bookmark = 1;
if (!$objecttype) {
$objecttype = ACTIVITY_OBJ_NOTE; // Default value
require_once 'include/plaintext.php';
- $objectdata = get_attached_data($body);
+ $objectdata = Plaintext::getAttachedData($body);
if ($objectdata["type"] == "link") {
$objecttype = ACTIVITY_OBJ_BOOKMARK;
* 'title' -> Title of the attachment
* 'description' -> Description of the attachment
*/
- function getOldAttachmentData($body)
+ private static function getOldAttachmentData($body)
{
$post = [];
* 'title' -> Title of the attachment
* 'description' -> Description of the attachment
*/
- function getAttachmentData($body)
+ public static function getAttachmentData($body)
{
$data = [];
if (!preg_match("/(.*)\[attachment(.*?)\](.*?)\[\/attachment\](.*)/ism", $body, $match)) {
- return get_old_attachment_data($body);
+ return self::getOldAttachmentData($body);
}
$attributes = $match[2];
return $data;
}
- function getAttachedData($body, $item = [])
+ public static function getAttachedData($body, $item = [])
{
/*
- text:
$has_title = !empty($item['title']);
$plink = (!empty($item['plink']) ? $item['plink'] : '');
- $post = get_attachment_data($body);
+ $post = self::getAttachmentData($body);
// if nothing is found, it maybe having an image.
if (!isset($post["type"])) {
*
* @todo For Twitter URLs aren't shortened, but they have to be calculated as if.
*/
- function shortenMsg($msg, $limit)
+ public static function shortenMsg($msg, $limit)
{
$lines = explode("\n", $msg);
$msg = "";
*
* @return string The converted message
*/
- function toPlaintext($b, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = "")
+ public static function toPlaintext($b, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = "")
{
// Remove the hash tags
$URLSearchString = "^\[\]";
// At first look at data that is attached via "type-..." stuff
// This will hopefully replaced with a dedicated bbcode later
- //$post = get_attached_data($b["body"]);
- $post = get_attached_data($body, $b);
+ //$post = self::getAttachedData($b["body"]);
+ $post = self::getAttachedData($body, $b);
if (($b["title"] != "") && ($post["text"] != "")) {
$post["text"] = trim($b["title"]."\n\n".$post["text"]);
} elseif (PConfig::get($b["uid"], "system", "no_intelligent_shortening")) {
$post["url"] = $b["plink"];
}
- $msg = shortenmsg($msg, $limit);
+ $msg = self::shortenMsg($msg, $limit);
}
}
namespace Friendica\Protocol;
use Friendica\App;
+use Friendica\Content\Text\Plaintext;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
*/
private static function formatPicturePost($body)
{
- $siteinfo = get_attached_data($body);
+ $siteinfo = Plaintext::getAttachedData($body);
if (($siteinfo["type"] == "photo")) {
if (isset($siteinfo["preview"])) {
private static function getAttachment($doc, $root, $item)
{
$o = "";
- $siteinfo = get_attached_data($item["body"]);
+ $siteinfo = Plaintext::getAttachedData($item["body"]);
switch ($siteinfo["type"]) {
case 'photo':