aboutsummaryrefslogtreecommitdiff
path: root/views/default/output/url.php
blob: 87f551ed11ff873e74c9df8c97219bd729adab1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

	/**
	 * Elgg URL display
	 * Displays a URL as a link
	 * 
	 * @package Elgg
	 * @subpackage Core

	 * @author Curverider Ltd

	 * @link http://elgg.org/
	 * 
	 * @uses $vars['value'] The URL to display
	 * 
	 */

    $val = trim($vars['value']);
    if (!empty($val)) {
	    if ((substr_count($val, "http://") == 0) && (substr_count($val, "https://") == 0)) {
	        $val = "http://" . $val;
	    }
	    
	    if ($vars['is_action'])
		{
			$ts = time();
			$token = generate_action_token($ts);
	    	
	    	$sep = "?";
			if (strpos($val, '?')>0) $sep = "&";
			$val = "$val{$sep}__elgg_token=$token&__elgg_ts=$ts";
		}
	    
	    echo "<a href=\"{$val}\" target=\"_blank\">". htmlentities($val, ENT_QUOTES, 'UTF-8'). "</a>";
    }

?>