Merge pull request #1002 from MrPetovan/task/8798-remove-items-php

[various] Replace *_page_info function calls with Content\PageInfo equivalent
pull/1003/head
Michael Vogel 2020-07-14 20:43:56 +02:00 committed by GitHub
commit 44f4557109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 10 deletions

View File

@ -8,6 +8,7 @@
*/ */
require_once 'mod/item.php'; require_once 'mod/item.php';
use Friendica\App; use Friendica\App;
use Friendica\Content\PageInfo;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
@ -185,7 +186,7 @@ function ifttt_message($uid, $item)
} }
if ($item['type'] == 'link') { if ($item['type'] == 'link') {
$data = query_page_info($item['link']); $data = PageInfo::queryUrl($item['link']);
if (isset($item['title']) && (trim($item['title']) != '')) { if (isset($item['title']) && (trim($item['title']) != '')) {
$data['title'] = $item['title']; $data['title'] = $item['title'];
@ -195,7 +196,7 @@ function ifttt_message($uid, $item)
$data['text'] = $item['description']; $data['text'] = $item['description'];
} }
$_REQUEST['body'] .= add_page_info_data($data); $_REQUEST['body'] .= "\n" . PageInfo::getFooterFromData($data);
} elseif (($item['type'] == 'photo') && ($item['image'] != '')) { } elseif (($item['type'] == 'photo') && ($item['image'] != '')) {
$_REQUEST['body'] .= "\n\n[img]" . $item['image'] . "[/img]\n"; $_REQUEST['body'] .= "\n\n[img]" . $item['image'] . "[/img]\n";
} }

View File

@ -925,8 +925,6 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id)
function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = true) function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = true)
{ {
require_once('include/items.php');
if (empty($post->object->id)) { if (empty($post->object->id)) {
Logger::log('Got empty like: '.print_r($post, true), Logger::DEBUG); Logger::log('Got empty like: '.print_r($post, true), Logger::DEBUG);
return; return;
@ -1096,8 +1094,6 @@ function pumpio_dodelete(App $a, $uid, $self, $post, $own_id)
function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcompletion = true) function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcompletion = true)
{ {
require_once('include/items.php');
if (($post->verb == "like") || ($post->verb == "favorite")) { if (($post->verb == "like") || ($post->verb == "favorite")) {
return pumpio_dolike($a, $uid, $self, $post, $own_id); return pumpio_dolike($a, $uid, $self, $post, $own_id);
} }

View File

@ -40,6 +40,7 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . '
use CodebirdSN\CodebirdSN; use CodebirdSN\CodebirdSN;
use Friendica\App; use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Content\PageInfo;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
use Friendica\Content\Text\Plaintext; use Friendica\Content\Text\Plaintext;
use Friendica\Core\Hook; use Friendica\Core\Hook;
@ -896,7 +897,7 @@ function statusnet_fetchtimeline(App $a, $uid)
$_REQUEST["title"] = ""; $_REQUEST["title"] = "";
$_REQUEST["body"] = add_page_info_to_body($post->text, true); $_REQUEST["body"] = PageInfo::appendToBody($post->text, true);
if (is_string($post->place->name)) { if (is_string($post->place->name)) {
$_REQUEST["location"] = $post->place->name; $_REQUEST["location"] = $post->place->name;
} }
@ -1494,7 +1495,7 @@ function statusnet_convertmsg(App $a, $body)
} }
if ($footerurl != "") { if ($footerurl != "") {
$footer = add_page_info($footerurl); $footer = "\n" . PageInfo::getFooterFromUrl($footerurl);
} }
if (($footerlink != "") && (trim($footer) != "")) { if (($footerlink != "") && (trim($footer) != "")) {

View File

@ -67,6 +67,7 @@ use Abraham\TwitterOAuth\TwitterOAuthException;
use Codebird\Codebird; use Codebird\Codebird;
use Friendica\App; use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Content\PageInfo;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Plaintext; use Friendica\Content\Text\Plaintext;
use Friendica\Core\Hook; use Friendica\Core\Hook;
@ -1356,7 +1357,7 @@ function twitter_expand_entities($body, stdClass $status, $picture)
if (empty($status->quoted_status)) { if (empty($status->quoted_status)) {
$footer = ''; $footer = '';
if ($attachmentUrl) { if ($attachmentUrl) {
$footer = add_page_info($attachmentUrl, false, $picture); $footer = "\n" . PageInfo::getFooterFromUrl($attachmentUrl, false, $picture);
} }
if (trim($footer)) { if (trim($footer)) {
@ -1364,7 +1365,7 @@ function twitter_expand_entities($body, stdClass $status, $picture)
} elseif ($picture) { } elseif ($picture) {
$body .= "\n\n[img]" . $picture . "[/img]\n"; $body .= "\n\n[img]" . $picture . "[/img]\n";
} else { } else {
$body = add_page_info_to_body($body); $body = PageInfo::appendToBody($body);
} }
} }