當前位置: 首頁>>代碼示例>>PHP>>正文


PHP error::createInvalidEmailError方法代碼示例

本文整理匯總了PHP中error::createInvalidEmailError方法的典型用法代碼示例。如果您正苦於以下問題:PHP error::createInvalidEmailError方法的具體用法?PHP error::createInvalidEmailError怎麽用?PHP error::createInvalidEmailError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在error的用法示例。


在下文中一共展示了error::createInvalidEmailError方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: clean_param


//.........這裏部分代碼省略.........
        return $newparam;
    }
    switch ($type) {
        case PARAM_TEXT:
            // leave only tags needed for multilang
            if (is_numeric($param)) {
                return $param;
            }
            $param = stripslashes($param);
            $param = clean_text($param);
            $param = strip_tags($param, '<lang><span>');
            $param = str_replace('+', '&#43;', $param);
            $param = str_replace('(', '&#40;', $param);
            $param = str_replace(')', '&#41;', $param);
            $param = str_replace('=', '&#61;', $param);
            $param = str_replace('"', '&quot;', $param);
            $param = str_replace('\'', '&#039;', $param);
            return $param;
        case PARAM_HTML:
            // keep as HTML, no processing
            $param = stripslashes($param);
            $param = clean_text($param);
            return trim($param);
        case PARAM_INT:
            return (int) $param;
        case PARAM_NUMBER:
            return (double) $param;
        case PARAM_ALPHA:
            // Remove everything not a-z
            return preg_replace('/([^a-zA-Z])/i', '', $param);
        case PARAM_ALPHANUM:
            // Remove everything not a-zA-Z0-9
            return preg_replace('/([^A-Za-z0-9])/i', '', $param);
        case PARAM_ALPHAEXT:
            // Remove everything not a-zA-Z/_-
            return preg_replace('/([^a-zA-Z\\/_-])/i', '', $param);
        case PARAM_ALPHANUMEXT:
            // Remove everything not a-zA-Z0-9-
            return preg_replace('/([^a-zA-Z0-9-])/i', '', $param);
        case PARAM_BOOL:
            // Convert to 1 or 0
            $tempstr = strtolower($param);
            if ($tempstr == 'on' or $tempstr == 'yes' or $tempstr == 'true') {
                $param = 1;
            } else {
                if ($tempstr == 'off' or $tempstr == 'no' or $tempstr == 'false') {
                    $param = 0;
                } else {
                    $param = empty($param) ? 0 : 1;
                }
            }
            return $param;
        case PARAM_BOOLTEXT:
            // check is an allowed text type boolean
            $tempstr = strtolower($param);
            if ($tempstr == 'on' or $tempstr == 'yes' or $tempstr == 'true' or $tempstr == 'off' or $tempstr == 'no' or $tempstr == 'false' or $tempstr == '0' or $tempstr == '1') {
                $param = $param;
            } else {
                $param = "";
            }
            return $param;
        case PARAM_PATH:
            // Strip all suspicious characters from file path
            $param = str_replace('\\\'', '\'', $param);
            $param = str_replace('\\"', '"', $param);
            $param = str_replace('\\', '/', $param);
            $param = ereg_replace('[[:cntrl:]]|[<>"`\\|\':]', '', $param);
            $param = ereg_replace('\\.\\.+', '', $param);
            $param = ereg_replace('//+', '/', $param);
            return ereg_replace('/(\\./)+', '/', $param);
        case PARAM_URL:
            // allow safe ftp, http, mailto urls
            include_once $CFG->dirAddress . 'core/lib/url-validation.class.php';
            $URLValidator = new mrsnk_URL_validation($param, MRSNK_URL_DO_NOT_PRINT_ERRORS, MRSNK_URL_DO_NOT_CONNECT_2_URL);
            if (!empty($param) && $URLValidator->isValid()) {
                // all is ok, param is respected
            } else {
                $param = '';
                // not really ok
            }
            return $param;
        case PARAM_EMAIL:
            if (validEmail($param)) {
                return $param;
            } else {
                $ERROR = new error();
                $ERROR->createInvalidEmailError();
                include_once $HUB_FLM->getCodeDirPath("core/formaterror.php");
                die;
            }
        case PARAM_XML:
            $param = parseFromXML($param);
            return $param;
        default:
            include_once $HUB_FLM->getCodeDirPath("core/formaterror.php");
            $ERROR = new error();
            $ERROR->createInvalidParameterError($type);
            die;
    }
}
開發者ID:uniteddiversity,項目名稱:LiteMap,代碼行數:101,代碼來源:sanitise.php


注:本文中的error::createInvalidEmailError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。