render_editlink: don't overwrite title if already set
This commit is contained in:
parent
899276cd13
commit
e799199016
1 changed files with 5 additions and 4 deletions
|
@ -62,9 +62,10 @@ function hook_shaargem_render_editlink($data)
|
|||
{
|
||||
// fetch title only for gemini:// iris
|
||||
if(isset($data['link']['url'])) {
|
||||
if(strstr($data['link']['url'],"gemini://"))
|
||||
{
|
||||
$data['link']['title'] = fetch_iri_title($data['link']['url']);
|
||||
if(strstr($data['link']['url'],"gemini://")) {
|
||||
if (!isset($data['link']['title'])) {
|
||||
$data['link']['title'] = fetch_iri_title($data['link']['url']);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
|
@ -144,7 +145,7 @@ function fetch_iri_title($iri)
|
|||
$fp = stream_socket_client("tls://".$domain[1].":1965", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $stream_context);
|
||||
|
||||
if (!$fp) {
|
||||
error_log("$errstr ($errno)");
|
||||
error_log("[shaargem] $errstr ($errno)");
|
||||
} else {
|
||||
fwrite($fp, $iri."\r\n");
|
||||
$header = fgets($fp);
|
||||
|
|
Loading…
Reference in a new issue