Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Make plain text URIs in text into clickable hyperlinks
- function autolinks($text) {
- global $prefs;
- // check to see if autolinks is enabled before calling this function
- // if ($prefs['feature_autolinks'] == "y") {
- $attrib = '';
- if ($prefs['popupLinks'] == 'y')
- $attrib .= 'target="_blank" ';
- $attrib .= 'rel="nofollow" ';
- if ($prefs['feature_wiki_ext_icon'] == 'y') {
- $attrib .= 'class="wiki external" ';
- $attrib .= 'rel="nofollow" ';
- $ext_icon = "<img border=\"0\" class=\"externallink\" src=\"img/icons/external_link.gif\" alt=\" (external link)\" />";
- } else {
- $attrib .= 'class="wiki" ';
- $ext_icon = "";
- }
- // *****
- // This section handles external links of the form [url] and such.
- // *****
- $links = $this->get_links($data);
- $notcachedlinks = $this->get_links_nocache($data);
- $cachedlinks = array_diff($links, $notcachedlinks);
- $this->cache_links($cachedlinks);
- // Note that there're links that are replaced
- foreach ($links as $link) {
- $target = '';
- $class = 'class="wiki"';
- $ext_icon = '';
- $rel='';
- if ($prefs['popupLinks'] == 'y') {
- $target = 'target="_blank"';
- $rel='nofollow';
- }
- if (!isset($_SERVER['SERVER_NAME']) && isset($_SERVER['HTTP_HOST'])) {
- $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
- }
- if (empty($_SERVER['SERVER_NAME']) || strstr($link, $_SERVER["SERVER_NAME"]) || !strstr($link, '://')) {
- $target = '';
- } else {
- $class = 'class="wiki external"';
- $rel='nofollow';
- if ($prefs['feature_wiki_ext_icon'] == 'y') {
- $ext_icon = "<img border=\"0\" class=\"externallink\" src=\"img/icons /external_link.gif\" alt=\" (external link)\" />";
- }
- $rel='external nofollow';
- }
Advertisement
Add Comment
Please, Sign In to add comment