diff --git a/composer.json b/composer.json index 2cb863c98..b3dd0ec90 100644 --- a/composer.json +++ b/composer.json @@ -82,7 +82,6 @@ "include/conversation.php", "include/dba.php", "include/enotify.php", - "include/items.php", "boot.php" ] }, diff --git a/doc/Addons.md b/doc/Addons.md index bff707fa8..54363cb1d 100644 --- a/doc/Addons.md +++ b/doc/Addons.md @@ -518,10 +518,6 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep- Hook::callAll('item_photo_menu', $args); Hook::callAll('jot_tool', $jotplugins); -### include/items.php - - Hook::callAll('page_info_data', $data); - ### mod/directory.php Hook::callAll('directory_item', $arr); diff --git a/doc/Message-Flow.md b/doc/Message-Flow.md index 69a10b232..e96798569 100644 --- a/doc/Message-Flow.md +++ b/doc/Message-Flow.md @@ -6,8 +6,6 @@ There are multiple paths, using multiple protocols and message formats. Those attempting to understand these message flows should become familiar with (at the minimum) the [DFRN protocol document](https://github.com/friendica/friendica/blob/stable/spec/dfrn2.pdf) and the message passing elements of the OStatus stack (salmon and Pubsubhubbub). -Most message passing involves the file include/items.php, which has functions for several feed-related import/export activities. - When a message is posted, all immediate deliveries to all networks are made using include/notifier.php, which chooses how (and to whom) to deliver the message. This file also invokes the local side of all deliveries including DFRN-notify. diff --git a/doc/de/Addons.md b/doc/de/Addons.md index b54f011bf..745010ff4 100644 --- a/doc/de/Addons.md +++ b/doc/de/Addons.md @@ -226,10 +226,6 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap Hook::callAll('item_photo_menu', $args); Hook::callAll('jot_tool', $jotplugins); -### include/items.php - - Hook::callAll('page_info_data', $data); - ### mod/directory.php Hook::callAll('directory_item', $arr); diff --git a/doc/de/Message-Flow.md b/doc/de/Message-Flow.md index 0a78d6917..ef2a0a271 100644 --- a/doc/de/Message-Flow.md +++ b/doc/de/Message-Flow.md @@ -8,8 +8,6 @@ Es gibt verschiedene Pfade, die verschiedene Protokolle und Nachrichtenformate n Diejenigen, die den Nachrichtenfluss genauer verstehen wollen, sollten sich mindestens mit dem DFRN-Protokoll ([Dokument mit den DFRN Spezifikationen](https://github.com/friendica/friendica/blob/stable/spec/dfrn2.pdf)) und den Elementen zur Nachrichtenverarbeitung des OStatus Stack informieren (salmon und Pubsubhubbub). -Der Großteil der Nachrichtenverarbeitung nutzt die Datei include/items.php, welche Funktionen für verschiedene Feed-bezogene Import-/Exportaktivitäten liefert. - Wenn eine Nachricht veröffentlicht wird, werden alle Übermittlungen an alle Netzwerke mit include/notifier.php durchgeführt, welche entscheidet, wie und an wen die Nachricht geliefert wird. Diese Datei bindet dabei die lokale Bearbeitung aller Übertragungen ein inkl. dfrn-notify. diff --git a/include/items.php b/include/items.php deleted file mode 100644 index 16fe897be..000000000 --- a/include/items.php +++ /dev/null @@ -1,74 +0,0 @@ -. - * - */ - -/** - * @deprecated since 2020.06 - * @see \Friendica\Content\PageInfo::getFooterFromData - */ -function add_page_info_data(array $data, $no_photos = false) -{ - return "\n" . \Friendica\Content\PageInfo::getFooterFromData($data, $no_photos); -} - -/** - * @deprecated since 2020.06 - * @see \Friendica\Content\PageInfo::queryUrl - */ -function query_page_info($url, $photo = "", $keywords = false, $keyword_denylist = "") -{ - return \Friendica\Content\PageInfo::queryUrl($url, $photo, $keywords, $keyword_denylist); -} - -/** - * @deprecated since 2020.06 - * @see \Friendica\Content\PageInfo::getTagsFromUrl() - */ -function get_page_keywords($url, $photo = "", $keywords = false, $keyword_denylist = "") -{ - return $keywords ? \Friendica\Content\PageInfo::getTagsFromUrl($url, $photo, $keyword_denylist) : []; -} - -/** - * @deprecated since 2020.06 - * @see \Friendica\Content\PageInfo::getFooterFromUrl - */ -function add_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_denylist = "") -{ - return "\n" . \Friendica\Content\PageInfo::getFooterFromUrl($url, $no_photos, $photo, $keywords, $keyword_denylist); -} - -/** - * @deprecated since 2020.06 - * @see \Friendica\Content\PageInfo::appendToBody - */ -function add_page_info_to_body($body, $texturl = false, $no_photos = false) -{ - return \Friendica\Content\PageInfo::appendToBody($body, $texturl, $no_photos); -} - -/** - * @deprecated since 2020.06 - * @see \Friendica\Protocol\Feed::consume - */ -function consume_feed($xml, array $importer, array $contact, &$hub) -{ - \Friendica\Protocol\Feed::consume($xml, $importer, $contact, $hub); -} diff --git a/mod/item.php b/mod/item.php index 6a3fd1896..e2d47ae2f 100644 --- a/mod/item.php +++ b/mod/item.php @@ -30,6 +30,7 @@ use Friendica\App; use Friendica\Content\Item as ItemHelper; +use Friendica\Content\PageInfo; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; use Friendica\Core\Logger; @@ -57,8 +58,6 @@ use Friendica\Util\Security; use Friendica\Util\Strings; use Friendica\Worker\Delivery; -require_once __DIR__ . '/../include/items.php'; - function item_post(App $a) { if (!Session::isAuthenticated()) { throw new HTTPException\ForbiddenException(); @@ -233,7 +232,7 @@ function item_post(App $a) { ]; } - $att_bbcode = add_page_info_data($attachment); + $att_bbcode = "\n" . PageInfo::getFooterFromData($attachment); $body .= $att_bbcode; } diff --git a/mod/parse_url.php b/mod/parse_url.php index b40ddf1d7..67610140b 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -24,6 +24,7 @@ */ use Friendica\App; +use Friendica\Content\PageInfo; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\System; @@ -177,7 +178,7 @@ function parse_url_content(App $a) } // Format it as BBCode attachment - $info = add_page_info_data($siteinfo); + $info = "\n" . PageInfo::getFooterFromData($siteinfo); echo $info; diff --git a/mod/pubsub.php b/mod/pubsub.php index cae346493..ece95dcea 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -25,6 +25,7 @@ use Friendica\Core\Protocol; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; +use Friendica\Protocol\Feed; use Friendica\Protocol\OStatus; use Friendica\Util\Strings; use Friendica\Util\Network; @@ -146,11 +147,11 @@ function pubsub_post(App $a) Logger::log('Import item for ' . $nick . ' from ' . $contact['nick'] . ' (' . $contact['id'] . ')'); $feedhub = ''; - consume_feed($xml, $importer, $contact, $feedhub); + Feed::consume($xml, $importer, $contact, $feedhub); // do it a second time for DFRN so that any children find their parents. if ($contact['network'] === Protocol::DFRN) { - consume_feed($xml, $importer, $contact, $feedhub); + Feed::consume($xml, $importer, $contact, $feedhub); } hub_post_return(); diff --git a/src/Module/Bookmarklet.php b/src/Module/Bookmarklet.php index 9ecce8ade..e5b3ee4ad 100644 --- a/src/Module/Bookmarklet.php +++ b/src/Module/Bookmarklet.php @@ -22,6 +22,7 @@ namespace Friendica\Module; use Friendica\BaseModule; +use Friendica\Content\PageInfo; use Friendica\Core\ACL; use Friendica\DI; use Friendica\Module\Security\Login; @@ -55,7 +56,7 @@ class Bookmarklet extends BaseModule throw new HTTPException\BadRequestException(DI::l10n()->t('This page is missing a url parameter.')); } - $content = add_page_info($_REQUEST["url"]); + $content = "\n" . PageInfo::getFooterFromUrl($_REQUEST['url']); $x = [ 'is_owner' => true, diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index de8fa2177..25b0f6689 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -22,6 +22,7 @@ namespace Friendica\Protocol; use Friendica\Content\Feature; +use Friendica\Content\PageInfo; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\Markdown; use Friendica\Core\Cache\Duration; @@ -2621,7 +2622,7 @@ class Diaspora $item["body"] = self::replacePeopleGuid($item["body"], $item["author-link"]); // Add OEmbed and other information to the body - $item["body"] = add_page_info_to_body($item["body"], false, true); + $item["body"] = PageInfo::appendToBody($item["body"], false, true); return $item; } else { @@ -2985,7 +2986,7 @@ class Diaspora // Add OEmbed and other information to the body if (!self::isHubzilla($contact["url"])) { - $body = add_page_info_to_body($body, false, true); + $body = PageInfo::appendToBody($body, false, true); } } diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index c3f6a4e0b..86b76d309 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -23,6 +23,7 @@ namespace Friendica\Protocol; use DOMDocument; use DOMXPath; +use Friendica\Content\PageInfo; use Friendica\Content\Text\HTML; use Friendica\Core\Logger; use Friendica\Core\Protocol; @@ -532,8 +533,8 @@ class Feed // We always strip the title since it will be added in the page information $item["title"] = ""; - $item["body"] = $item["body"] . add_page_info($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_denylist"] ?? ''); - $taglist = get_page_keywords($item["plink"], $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_denylist"]); + $item["body"] = $item["body"] . "\n" . PageInfo::getFooterFromUrl($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_denylist"] ?? ''); + $taglist = $contact["fetch_further_information"] == 2 ? PageInfo::getTagsFromUrl($item["plink"], $preview, $contact["ffi_keyword_denylist"] ?? '') : []; $item["object-type"] = Activity\ObjectType::BOOKMARK; unset($item["attach"]); } else { @@ -543,7 +544,7 @@ class Feed if (!empty($contact["fetch_further_information"]) && ($contact["fetch_further_information"] == 3)) { if (empty($taglist)) { - $taglist = get_page_keywords($item["plink"], $preview, true, $contact["ffi_keyword_denylist"]); + $taglist = PageInfo::getTagsFromUrl($item["plink"], $preview, $contact["ffi_keyword_denylist"]); } $item["body"] .= "\n" . self::tagToString($taglist); } else { diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index ef2515c1f..90606af1c 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -23,6 +23,7 @@ namespace Friendica\Protocol; use DOMDocument; use DOMXPath; +use Friendica\Content\PageInfo; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Core\Cache\Duration; @@ -697,7 +698,7 @@ class OStatus // Only add additional data when there is no picture in the post if (!strstr($item["body"], '[/img]')) { - $item["body"] = add_page_info_to_body($item["body"]); + $item["body"] = PageInfo::appendToBody($item["body"]); } Tag::storeFromBody($item['uri-id'], $item['body']); @@ -1120,7 +1121,7 @@ class OStatus if (($item["object-type"] == Activity\ObjectType::QUESTION) || ($item["object-type"] == Activity\ObjectType::EVENT) ) { - $item["body"] .= add_page_info($attribute['href']); + $item["body"] .= "\n" . PageInfo::getFooterFromUrl($attribute['href']); } break; case "ostatus:conversation": @@ -1153,7 +1154,7 @@ class OStatus } $link_data['related'] = $attribute['href']; } else { - $item["body"] .= add_page_info($attribute['href']); + $item["body"] .= "\n" . PageInfo::getFooterFromUrl($attribute['href']); } break; case "self": diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index 8bcc0d3e3..c7b61dacc 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -42,8 +42,6 @@ use Friendica\Protocol\Diaspora; use Friendica\Protocol\OStatus; use Friendica\Protocol\Salmon; -require_once 'include/items.php'; - /* * The notifier is typically called with: * diff --git a/src/Worker/OnePoll.php b/src/Worker/OnePoll.php index fbe92215d..a2659f4e7 100644 --- a/src/Worker/OnePoll.php +++ b/src/Worker/OnePoll.php @@ -31,6 +31,7 @@ use Friendica\Model\User; use Friendica\Protocol\Activity; use Friendica\Protocol\ActivityPub; use Friendica\Protocol\Email; +use Friendica\Protocol\Feed; use Friendica\Protocol\PortableContact; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -173,11 +174,11 @@ class OnePoll Logger::log("Consume feed of contact ".$contact['id']); - consume_feed($xml, $importer, $contact, $hub); + Feed::consume($xml, $importer, $contact, $hub); // do it a second time for DFRN so that any children find their parents. if ($protocol === Protocol::DFRN) { - consume_feed($xml, $importer, $contact, $hub); + Feed::consume($xml, $importer, $contact, $hub); } $hubmode = 'subscribe';