* @link https://www.oos-shop.de */ /** ensure this file is being included by a parent file */ defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' ); /** * Valid e-Mail - Addresses * * @param $value * @return boolean */ function oos_validate_is_email($value) { if (!is_string($value)) return FALSE; //Reject line breaks in addresses; it's valid RFC5322, but not RFC5321 if (strpos($value, "\n") !== FALSE or strpos($value, "\r") !== FALSE) { return FALSE; } return (boolean)filter_var($value, FILTER_VALIDATE_EMAIL); } /** * test if a value is a valid URL * * @param string $sUrl the value being tested */ function oos_validate_is_url($sUrl) { if (strlen($sUrl) == 0) { return FALSE; } return preg_match('!^http(s)?://[\w-]+\.[\w-]+(\S+)?$!i', $sUrl); }