1
1
Fork 0

Update function calls

update to new function calls
This commit is contained in:
Adam Magness 2018-01-26 19:14:47 -05:00
parent 792f069c6e
commit 21881f2885
5 changed files with 21 additions and 19 deletions

View file

@ -8,6 +8,7 @@
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;
@ -47,7 +48,6 @@ require_once 'include/html2bbcode.php';
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');
@ -5196,7 +5196,7 @@ function api_clean_plain_items($Text)
*/
function api_clean_attachments($body)
{
$data = get_attachment_data($body);
$data = Plaintext::getAttachmentData($body);
if (!$data) {
return $body;

View file

@ -5,6 +5,7 @@
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;
@ -15,7 +16,6 @@ use Friendica\Util\Map;
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) {
@ -57,7 +57,7 @@ function bb_map_location($match) {
*/
function bb_attachment($return, $simplehtml = false, $tryoembed = true)
{
$data = get_attachment_data($return);
$data = Plaintext::getAttachmentData($return);
if (!$data) {
return $return;
}
@ -120,7 +120,7 @@ function bb_attachment($return, $simplehtml = false, $tryoembed = true)
function bb_remove_share_information($Text, $plaintext = false, $nolink = false) {
$data = get_attachment_data($Text);
$data = Plaintext::getAttachmentData($Text);
if (!$data) {
return $Text;

View file

@ -15,6 +15,7 @@
* information.
*/
use Friendica\App;
use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
@ -506,7 +507,7 @@ function item_post(App $a) {
// 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;
@ -524,7 +525,7 @@ function item_post(App $a) {
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;

View file

@ -28,7 +28,7 @@ class Plaintext
* 'title' -> Title of the attachment
* 'description' -> Description of the attachment
*/
function getOldAttachmentData($body)
private static function getOldAttachmentData($body)
{
$post = [];
@ -97,12 +97,12 @@ class Plaintext
* '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];
@ -202,7 +202,7 @@ class Plaintext
return $data;
}
function getAttachedData($body, $item = [])
public static function getAttachedData($body, $item = [])
{
/*
- text:
@ -216,7 +216,7 @@ class Plaintext
$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"])) {
@ -329,7 +329,7 @@ class Plaintext
*
* @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 = "";
@ -360,7 +360,7 @@ class Plaintext
*
* @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 = "^\[\]";
@ -374,8 +374,8 @@ class Plaintext
// 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"]);
@ -496,7 +496,7 @@ class Plaintext
} elseif (PConfig::get($b["uid"], "system", "no_intelligent_shortening")) {
$post["url"] = $b["plink"];
}
$msg = shortenmsg($msg, $limit);
$msg = self::shortenMsg($msg, $limit);
}
}

View file

@ -5,6 +5,7 @@
namespace Friendica\Protocol;
use Friendica\App;
use Friendica\Content\Text\Plaintext;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
@ -1205,7 +1206,7 @@ class OStatus
*/
private static function formatPicturePost($body)
{
$siteinfo = get_attached_data($body);
$siteinfo = Plaintext::getAttachedData($body);
if (($siteinfo["type"] == "photo")) {
if (isset($siteinfo["preview"])) {
@ -1327,7 +1328,7 @@ class OStatus
private static function getAttachment($doc, $root, $item)
{
$o = "";
$siteinfo = get_attached_data($item["body"]);
$siteinfo = Plaintext::getAttachedData($item["body"]);
switch ($siteinfo["type"]) {
case 'photo':