show external link names MOD...
Posted: Mon Jan 02, 2017 8:05 pm
this is a MOD to show external link names that is used here. i got the code from RMcGirr83's site when it was still around
the finds are adjusted to work with phpBB 3.1.10 as it is exactly what is used here
the finds are adjusted to work with phpBB 3.1.10 as it is exactly what is used here
Open includes/functions_content.php
Find
Tip: This may be a partial find and not the whole line.
Tip: Add the following line(s) on a new blank line before the preceding line(s) of find.
Tip: This may be a partial find and not the whole line.
Tip: Add the following line(s) on a new blank line after the preceding line(s) of find.
Tip: This may be a partial find and not the whole line.
Tip: Add the following line(s) on a new blank line after the preceding line(s) of find.
Tip: This may be a partial find and not the whole line.
Code: Select all
Add before/**
* A subroutine of make_clickable used with preg_replace
Tip: Add the following line(s) on a new blank line before the preceding line(s) of find.
Code: Select all
Find/**
* A subroutine of make_clickable to retrieve
* titles of links posted
*
*/
function make_title_link($url, $text)
{
$handle = @file_get_contents($url);
if(!empty($handle))
{
preg_match('@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s+charset=([^\s"]+))?@i', $handle, $matches );
if(isset($matches[3]))
{
$handle = $handle;
}
else
{
$handle = mb_convert_encoding($handle, 'HTML-ENTITIES', "UTF-8");
}
$dom = new DOMDocument();
if (@$dom->loadHTML($handle))
{
$xpath = new DOMXPath($dom);
if (!empty($xpath->query('//title')->item(0)->nodeValue))
{
$title = $xpath->query('//title')->item(0)->nodeValue;
$text = str_replace("\n", " ",$title);
return $text;
}
}
}
return $text;
}
Tip: This may be a partial find and not the whole line.
Code: Select all
Add after $tag = 'm';
$text = $short_url;
Tip: Add the following line(s) on a new blank line after the preceding line(s) of find.
Code: Select all
Find$text = make_title_link($url, $text);
Tip: This may be a partial find and not the whole line.
Code: Select all
Add after $url = 'http://' . $url;
$text = $short_url;
Tip: Add the following line(s) on a new blank line after the preceding line(s) of find.
Code: Select all
$text = make_title_link($url, $text);