Replace *_page_info function calls with Content\PageInfo equivalent

This commit is contained in:
Hypolite Petovan 2020-07-14 10:15:04 -04:00
parent a1d62734fa
commit 3e25fc3a72
7 changed files with 17 additions and 56 deletions

View File

@ -18,48 +18,3 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
/**
* @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);
}

View File

@ -30,6 +30,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Item as ItemHelper; use Friendica\Content\Item as ItemHelper;
use Friendica\Content\PageInfo;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
@ -233,7 +234,7 @@ function item_post(App $a) {
]; ];
} }
$att_bbcode = add_page_info_data($attachment); $att_bbcode = "\n" . PageInfo::getFooterFromData($attachment);
$body .= $att_bbcode; $body .= $att_bbcode;
} }

View File

@ -24,6 +24,7 @@
*/ */
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\System; use Friendica\Core\System;
@ -177,7 +178,7 @@ function parse_url_content(App $a)
} }
// Format it as BBCode attachment // Format it as BBCode attachment
$info = add_page_info_data($siteinfo); $info = "\n" . PageInfo::getFooterFromData($siteinfo);
echo $info; echo $info;

View File

@ -22,6 +22,7 @@
namespace Friendica\Module; namespace Friendica\Module;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Content\PageInfo;
use Friendica\Core\ACL; use Friendica\Core\ACL;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Security\Login; 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.')); 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 = [ $x = [
'is_owner' => true, 'is_owner' => true,

View File

@ -22,6 +22,7 @@
namespace Friendica\Protocol; namespace Friendica\Protocol;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Content\PageInfo;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Markdown; use Friendica\Content\Text\Markdown;
use Friendica\Core\Cache\Duration; use Friendica\Core\Cache\Duration;
@ -2621,7 +2622,7 @@ class Diaspora
$item["body"] = self::replacePeopleGuid($item["body"], $item["author-link"]); $item["body"] = self::replacePeopleGuid($item["body"], $item["author-link"]);
// Add OEmbed and other information to the body // 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; return $item;
} else { } else {
@ -2985,7 +2986,7 @@ class Diaspora
// Add OEmbed and other information to the body // Add OEmbed and other information to the body
if (!self::isHubzilla($contact["url"])) { if (!self::isHubzilla($contact["url"])) {
$body = add_page_info_to_body($body, false, true); $body = PageInfo::appendToBody($body, false, true);
} }
} }

View File

@ -23,6 +23,7 @@ namespace Friendica\Protocol;
use DOMDocument; use DOMDocument;
use DOMXPath; use DOMXPath;
use Friendica\Content\PageInfo;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
@ -532,8 +533,8 @@ class Feed
// We always strip the title since it will be added in the page information // We always strip the title since it will be added in the page information
$item["title"] = ""; $item["title"] = "";
$item["body"] = $item["body"] . add_page_info($item["plink"], false, $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 = get_page_keywords($item["plink"], $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; $item["object-type"] = Activity\ObjectType::BOOKMARK;
unset($item["attach"]); unset($item["attach"]);
} else { } else {
@ -543,7 +544,7 @@ class Feed
if (!empty($contact["fetch_further_information"]) && ($contact["fetch_further_information"] == 3)) { if (!empty($contact["fetch_further_information"]) && ($contact["fetch_further_information"] == 3)) {
if (empty($taglist)) { 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); $item["body"] .= "\n" . self::tagToString($taglist);
} else { } else {

View File

@ -23,6 +23,7 @@ namespace Friendica\Protocol;
use DOMDocument; use DOMDocument;
use DOMXPath; use DOMXPath;
use Friendica\Content\PageInfo;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
use Friendica\Core\Cache\Duration; use Friendica\Core\Cache\Duration;
@ -697,7 +698,7 @@ class OStatus
// Only add additional data when there is no picture in the post // Only add additional data when there is no picture in the post
if (!strstr($item["body"], '[/img]')) { 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']); Tag::storeFromBody($item['uri-id'], $item['body']);
@ -1120,7 +1121,7 @@ class OStatus
if (($item["object-type"] == Activity\ObjectType::QUESTION) if (($item["object-type"] == Activity\ObjectType::QUESTION)
|| ($item["object-type"] == Activity\ObjectType::EVENT) || ($item["object-type"] == Activity\ObjectType::EVENT)
) { ) {
$item["body"] .= add_page_info($attribute['href']); $item["body"] .= "\n" . PageInfo::getFooterFromUrl($attribute['href']);
} }
break; break;
case "ostatus:conversation": case "ostatus:conversation":
@ -1153,7 +1154,7 @@ class OStatus
} }
$link_data['related'] = $attribute['href']; $link_data['related'] = $attribute['href'];
} else { } else {
$item["body"] .= add_page_info($attribute['href']); $item["body"] .= "\n" . PageInfo::getFooterFromUrl($attribute['href']);
} }
break; break;
case "self": case "self":