diff options
Diffstat (limited to 'engine/lib/input.php')
| -rw-r--r-- | engine/lib/input.php | 73 | 
1 files changed, 46 insertions, 27 deletions
diff --git a/engine/lib/input.php b/engine/lib/input.php index 8cbea6986..9244c16f3 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -1,37 +1,37 @@ -<?php -	/** -	 * Parameter input functions. -	 * This file contains functions for getting input from get/post variables. -	 *  -	 * @package Elgg -	 * @subpackage Core -	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 -	 * @author Marcus Povey <marcus@dushka.co.uk> -	 * @copyright Curverider Ltd 2008 -	 * @link http://elgg.org/ -	 */ - -	/** -	 * Get some input from variables passed on the GET or POST line. -	 *  -	 * @param $variable string The variable we want to return. -	 * @param $default mixed A default value for the variable if it is not found. -	 */ -	function get_input($variable, $default = "") -	{ - +<?php
 +	/**
 +	 * Parameter input functions.
 +	 * This file contains functions for getting input from get/post variables.
 +	 * 
 +	 * @package Elgg
 +	 * @subpackage Core
 +	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 +	 * @author Marcus Povey <marcus@dushka.co.uk>
 +	 * @copyright Curverider Ltd 2008
 +	 * @link http://elgg.org/
 +	 */
 +
 +	/**
 +	 * Get some input from variables passed on the GET or POST line.
 +	 * 
 +	 * @param $variable string The variable we want to return.
 +	 * @param $default mixed A default value for the variable if it is not found.
 +	 */
 +	function get_input($variable, $default = "")
 +	{
 +
  		if (isset($_REQUEST[$variable])) {
 -			$value = $_REQUEST[$variable]; +			$value = $_REQUEST[$variable];
  			return trim($_REQUEST[$variable]);
  		}
  		global $CONFIG;
  		if (isset($CONFIG->input[$variable]))
 -			return $CONFIG->input[$variable]; - +			return $CONFIG->input[$variable];
 +
  		return $default;
 - +
  	}
  	/**
 @@ -49,5 +49,24 @@  	}
 -	 +	    /**
 +        * This is a function to make url clickable
 +        * @param string text
 +        * @return string text
 +        **/
 +        
 +       function parse_urls($text) {
 +           
 +            if (preg_match_all('/(?<!href=["\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\'\!\(\)]+)/ie', $text, $urls))   {
 +               
 +                foreach (array_unique($urls[1]) AS $url){
 +                    $urltext = $url;
 +                    $text = str_replace($url, '<a href="'. $url .'" style="text-decoration:underline;">view link</a>', $text);
 +                }
 +            }
 +            
 +            return $text;
 +        }
 +	
 +	
  ?>
\ No newline at end of file  | 
