* @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])) { if (is_array($_REQUEST[$variable])) return $_REQUEST[$variable]; else return trim($_REQUEST[$variable]); } global $CONFIG; if (isset($CONFIG->input[$variable])) return $CONFIG->input[$variable]; return $default; } /** * Sets an input value that may later be retrieved by get_input * * @param string $variable The name of the variable * @param string $value The value of the variable */ function set_input($variable, $value) { global $CONFIG; if (!isset($CONFIG->input)) $CONFIG->input = array(); $CONFIG->input[trim($variable)] = trim($value); } /** * This is a function to make url clickable * @param string text * @return string text **/ function parse_urls($text) { if (preg_match_all('/(?"\'\!\(\)]+)/ie', $text, $urls)) { foreach (array_unique($urls[1]) AS $url){ $urltext = $url; $text = str_replace($url, 'view link', $text); } } return $text; } ?>