mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-17 04:15:15 +02:00
New hook "getsiteinfo", separating fetching site info from generating bbcode
This commit is contained in:
parent
bb0b1918a1
commit
3600289262
2 changed files with 26 additions and 8 deletions
|
@ -888,13 +888,7 @@ function get_atom_elements($feed, $item, $contact = array()) {
|
|||
return $res;
|
||||
}
|
||||
|
||||
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false) {
|
||||
require_once("mod/parse_url.php");
|
||||
|
||||
$data = parseurl_getsiteinfo($url, true);
|
||||
|
||||
logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
|
||||
|
||||
function add_page_info_data($data) {
|
||||
// It maybe is a rich content, but if it does have everything that a link has,
|
||||
// then treat it that way
|
||||
if (($data["type"] == "rich") AND is_string($data["title"]) AND
|
||||
|
@ -921,7 +915,7 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
|
|||
$text .= "[quote]".$data["text"]."[/quote]";
|
||||
|
||||
$hashtags = "";
|
||||
if ($keywords AND isset($data["keywords"])) {
|
||||
if (isset($data["keywords"]) AND count($data["keywords"])) {
|
||||
$a = get_app();
|
||||
$hashtags = "\n";
|
||||
foreach ($data["keywords"] AS $keyword) {
|
||||
|
@ -933,6 +927,21 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
|
|||
return("\n[class=type-".$data["type"]."]".$text."[/class]".$hashtags);
|
||||
}
|
||||
|
||||
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false) {
|
||||
require_once("mod/parse_url.php");
|
||||
|
||||
$data = parseurl_getsiteinfo($url, true);
|
||||
|
||||
logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
|
||||
|
||||
if (!$keywords AND isset($data["keywords"]))
|
||||
unset($data["keywords"]);
|
||||
|
||||
$text = add_page_info_data($data);
|
||||
|
||||
return($text);
|
||||
}
|
||||
|
||||
function add_page_info_to_body($body, $texturl = false, $no_photos = false) {
|
||||
|
||||
logger('add_page_info_to_body: fetch page info for body '.$body, LOGGER_DEBUG);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue