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


PHP string_normalize函數代碼示例

本文整理匯總了PHP中string_normalize函數的典型用法代碼示例。如果您正苦於以下問題:PHP string_normalize函數的具體用法?PHP string_normalize怎麽用?PHP string_normalize使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: prepare_realname

 private function prepare_realname($p_user_info, $p_username)
 {
     switch ($this->_mail_preferred_realname) {
         case 'email_address':
             $t_realname = $p_user_info['email'];
             break;
         case 'email_no_domain':
             if (preg_match(email_regex_simple(), $p_user_info['email'], $t_check)) {
                 $t_local = $t_check[1];
                 $t_domain = $t_check[2];
                 $t_realname = $t_local;
             }
             break;
         case 'from_ldap':
             $t_realname = ldap_realname_from_username($p_username);
             break;
         case 'full_from':
             $t_realname = str_replace(array('<', '>'), array('(', ')'), $p_user_info['From']);
             break;
         case 'name':
         default:
             $t_realname = $p_user_info['name'];
     }
     $t_realname = string_normalize($t_realname);
     if (utf8_strlen($t_realname) > DB_FIELD_SIZE_REALNAME) {
         $t_realname = utf8_substr($t_realname, 0, DB_FIELD_SIZE_REALNAME);
     }
     if (user_is_realname_valid($t_realname) && user_is_realname_unique($p_username, $t_realname)) {
         return $t_realname;
     }
     return FALSE;
 }
開發者ID:JeromyK,項目名稱:EmailReporting,代碼行數:32,代碼來源:mail_api.php

示例2: email_append_domain

$t_redirect = 'account_page.php';
$t_email_updated = false;
$t_password_updated = false;
$t_realname_updated = false;
/** @todo Listing what fields were updated is not standard behaviour of MantisBT - it also complicates the code. */
if (OFF == config_get('use_ldap_email')) {
    $f_email = email_append_domain($f_email);
    email_ensure_valid($f_email);
    email_ensure_not_disposable($f_email);
    if ($f_email != user_get_email($t_user_id)) {
        user_set_email($t_user_id, $f_email);
        $t_email_updated = true;
    }
}
# strip extra spaces from real name
$t_realname = string_normalize($f_realname);
if ($t_realname != user_get_field($t_user_id, 'realname')) {
    # checks for problems with realnames
    $t_username = user_get_field($t_user_id, 'username');
    user_ensure_realname_unique($t_username, $t_realname);
    user_set_realname($t_user_id, $t_realname);
    $t_realname_updated = true;
}
# Update password if the two match and are not empty
if (!is_blank($f_password)) {
    if ($f_password != $f_password_confirm) {
        trigger_error(ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR);
    } else {
        if (!auth_does_password_match($t_user_id, $f_password)) {
            user_set_password($t_user_id, $f_password);
            $t_password_updated = true;
開發者ID:kaos,項目名稱:mantisbt,代碼行數:31,代碼來源:account_update.php

示例3: url_title

 function url_title($str, $separator = 'dash')
 {
     if ($separator == 'dash') {
         $search = '_';
         $replace = '-';
     } else {
         $search = '-';
         $replace = '_';
     }
     $str = string_normalize($str);
     $trans = array($search => $replace, "\\s+" => $replace, "[^\\.a-z0-9" . $replace . "]" => '', $replace . "+" => $replace, $replace . "\$" => '', "^" . $replace => '');
     $str = strip_tags(strtolower($str));
     foreach ($trans as $key => $val) {
         $str = preg_replace("#" . $key . "#", $val, $str);
     }
     return trim(stripslashes($str));
 }
開發者ID:rexcarnation,項目名稱:XtraUpload,代碼行數:17,代碼來源:url_helper.php


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