Merge pull request #1195 from annando/1410-new-hook-getsiteinfo
New hook "getsiteinfo" and "page_info_data"
This commit is contained in:
commit
9d6bcd2572
|
@ -888,12 +888,8 @@ function get_atom_elements($feed, $item, $contact = array()) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false) {
|
function add_page_info_data($data) {
|
||||||
require_once("mod/parse_url.php");
|
call_hooks('page_info_data', $data);
|
||||||
|
|
||||||
$data = parseurl_getsiteinfo($url, true);
|
|
||||||
|
|
||||||
logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
|
|
||||||
|
|
||||||
// It maybe is a rich content, but if it does have everything that a link has,
|
// It maybe is a rich content, but if it does have everything that a link has,
|
||||||
// then treat it that way
|
// then treat it that way
|
||||||
|
@ -921,7 +917,7 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
|
||||||
$text .= "[quote]".$data["text"]."[/quote]";
|
$text .= "[quote]".$data["text"]."[/quote]";
|
||||||
|
|
||||||
$hashtags = "";
|
$hashtags = "";
|
||||||
if ($keywords AND isset($data["keywords"])) {
|
if (isset($data["keywords"]) AND count($data["keywords"])) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$hashtags = "\n";
|
$hashtags = "\n";
|
||||||
foreach ($data["keywords"] AS $keyword) {
|
foreach ($data["keywords"] AS $keyword) {
|
||||||
|
@ -933,6 +929,21 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
|
||||||
return("\n[class=type-".$data["type"]."]".$text."[/class]".$hashtags);
|
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) {
|
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);
|
logger('add_page_info_to_body: fetch page info for body '.$body, LOGGER_DEBUG);
|
||||||
|
|
|
@ -333,6 +333,8 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
|
||||||
|
|
||||||
logger("parseurl_getsiteinfo: Siteinfo for ".$url." ".print_r($siteinfo, true), LOGGER_DEBUG);
|
logger("parseurl_getsiteinfo: Siteinfo for ".$url." ".print_r($siteinfo, true), LOGGER_DEBUG);
|
||||||
|
|
||||||
|
call_hooks('getsiteinfo', $siteinfo);
|
||||||
|
|
||||||
return($siteinfo);
|
return($siteinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,6 +412,13 @@ function parse_url_content(&$a) {
|
||||||
|
|
||||||
$siteinfo = parseurl_getsiteinfo($url);
|
$siteinfo = parseurl_getsiteinfo($url);
|
||||||
|
|
||||||
|
// if ($textmode) {
|
||||||
|
// require_once("include/items.php");
|
||||||
|
//
|
||||||
|
// echo add_page_info_data($siteinfo);
|
||||||
|
// killme();
|
||||||
|
// }
|
||||||
|
|
||||||
$url= $siteinfo["url"];
|
$url= $siteinfo["url"];
|
||||||
|
|
||||||
$sitedata = "";
|
$sitedata = "";
|
||||||
|
|
Loading…
Reference in a new issue