/** * Determines if a string is alpha only * * @param string $value The value to check for alpha (letters) only * @param string $allow Any additional allowable characters * @return boolean */ function isAlpha($value, $allow = '') { if (preg_match('/^[a-zA-Z' . $allow . ']+$/', $value)) { return true; } else { return false; } } /** * Determines if a string is alpha-numeric * * @param string $value The value to check * @return boolean TRUE if there are letters and numbers, FALSE if other */ function isAlphaNumeric($value) { if (preg_match("/^[A-Za-z0-9 ]+$/", $value)) { return true; } else { return false; } } /** * Determines if a string contains a valid date * * @param string $value The value to inspect * @return boolean TRUE if the value is a date, FALSE if not */ function isDate($value) { $date = date('Y', strtotime($value)); if ($date == "1969" || $date == '') { return false; } else { return true; } } /** * Checks for a valid email address * * @param string $email The value to validate as an email address * @return boolean TRUE if it is a valid email address, FALSE if not */ function isEmail($email) { $pattern = "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/"; if (preg_match($pattern, $email)) { return true; } else { return false; } } /** * Checks to see if a variable is a number * * @param integer $number The value to check * @return boolean TRUE if the value is a number, FALSE if not */ function isNumber($number) { if (preg_match("/^\-?\+?[0-9e1-9]+$/", $number)) { return true; } else { return false; } } function puliscitesto($strText) { //returns safe code for preloading in the RTE $tmpString = $strText; //convert all types of single quotes $tmpString = str_replace(chr(145), chr(39), $tmpString); $tmpString = str_replace(chr(146), chr(39), $tmpString); $tmpString = str_replace("'", "'", $tmpString); //convert all types of double quotes $tmpString = str_replace(chr(147), chr(34), $tmpString); $tmpString = str_replace(chr(148), chr(34), $tmpString); // $tmpString = str_replace("\"", "\"", $tmpString); //replace carriage returns & line feeds $tmpString = str_replace(chr(10), " ", $tmpString); $tmpString = str_replace(chr(13), " ", $tmpString); return $tmpString; } ?>