本文整理汇总了PHP中functions::strip_accents方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::strip_accents方法的具体用法?PHP functions::strip_accents怎么用?PHP functions::strip_accents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions
的用法示例。
在下文中一共展示了functions::strip_accents方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dotName
public static function dotName($name)
{
if (preg_match("/Hans(.*)Mühlen/", $name)) {
return "hans.muhlen";
}
return functions::strip_accents(mb_strtolower(str_replace("ð", "d", str_replace(" ", ".", str_replace(" ", ".", str_replace("‑", ".", str_replace(".", "", $name)))))));
}
示例2: getAlumniArrayData
public static function getAlumniArrayData()
{
$userarray = array();
// --------------------
// DETERMINE SOURCE OF PEOPLE DATA
// --> $GLOBALS["peopleClass"]
// --------------------
self::loadClass("ea");
// ---------------------------------------------------------------------------
// SELECT APPROPRIATE SQL QUERY
// If $searchVariant='user', only the record for user $u is selected.
// --> $sql
// ---------------------------------------------------------------------------
$sql = $GLOBALS["peopleClass"]->getSqlForEmployment();
// --------------------
// OBTAIN DATA FROM DATABASE
// --> $userarray
// --------------------
$countryCodeArray = functions::countryCodeArray();
$result = $GLOBALS["peopleClass"]->query($sql);
if ($GLOBALS["peopleClass"]->num_rows($result) > 0) {
while ($rec = $GLOBALS["peopleClass"]->next_record_assoc($result)) {
if (!empty($rec["lm_option"])) {
$options = @unserialize(stripslashes($rec["lm_option"]));
if ($options) {
$rec = @array_merge($rec, $options);
}
}
if (!empty($rec["av_id"])) {
$udata = array();
// -----------------------------------
$udata["nw_firstname"] = isset($rec["av_firstname"]) ? $rec["av_firstname"] : "";
$udata["nw_lastname"] = isset($rec["av_lastname"]) ? $rec["av_lastname"] : "";
$udata["nw_fullname"] = str_replace(" ", " ", str_replace("-", "‑", $udata["nw_firstname"])) . " " . str_replace(" ", " ", str_replace("-", "‑", $udata["nw_lastname"]));
$udata["nw_fullname_reverse"] = str_replace(" ", " ", preg_replace("/" . (!empty($rec["av_von"]) ? $rec["av_von"] . "\\s*" : "") . "/i", "", str_replace("-", "‑", $udata["nw_lastname"]))) . ", " . str_replace(" ", " ", str_replace("-", "‑", $udata["nw_firstname"])) . (!empty($rec["av_von"]) ? " " . $rec["av_von"] : "");
$udata["nw_fullname_reverse_sortable"] = strtolower(functions::strip_accents($udata["nw_fullname_reverse"]));
$udata["nw_user"] = functions::dotName($udata["nw_fullname"]);
if (self::getSpecialDotname($udata["nw_user"])) {
$udata["nw_user"] = self::getSpecialDotname($udata["nw_user"]);
}
$udata["nw_current_institute"] = $rec["av_institute"];
$udata["nw_current_email"] = functions::obscurify_email($rec["av_email"]);
$udata["nw_deceased"] = !empty($rec["av_ddate"]) ? 1 : 0;
// -----------------------------------
// COLLECT DATA FROM OTHER SOURCES, IF NEEDED
// -----------------------------------
include PATH_DATA . "/adhoc_people_data.php";
// -----------------------------------
// SPECIAL EMPLOYMENT-RELATED FIELDS
// -----------------------------------
$em = array();
$em["nw_employment_status"] = $rec["um_status"];
$em["nw_employment_title"] = $rec["lm_value"];
$em["nw_employment_fromdate"] = $rec["lm_key"];
$em["nw_employment_todate"] = $rec["lm_status"];
if ($rec["lm_status"] <= date("Y-m-d")) {
$em["nw_employment_date"] = functions::readableDateInterval($rec["lm_key"], $rec["lm_status"]);
$em["nw_employment_current"] = 0;
} else {
$em["nw_employment_date"] = functions::readableDate($rec["lm_key"]) . " — ";
$em["nw_employment_current"] = 1;
}
$em["nw_employment_inst"] = isset($options["e_inst"]) ? $options["e_inst"] : "";
if (isset($options["e_org"])) {
switch ($options["e_org"]) {
case MYPEAR_ORGID_NORDITA:
$em["nw_employment_inst"] = "Nordita";
$em["nw_employment_country"] = $em["nw_employment_fromdate"] >= date("2007-01-01") || in_array($rec["user"], array("yb", "brandenb", "jifalt", "uw", "divecchi")) ? "SE" : "DK";
break;
case MYPEAR_ORGID_FYSIKUM:
$em["nw_employment_inst"] = "Stockholm University";
$em["nw_employment_country"] = "SE";
break;
case MYPEAR_ORGID_ALBANOVA:
$em["nw_employment_inst"] = "AlbaNova";
$em["nw_employment_country"] = "SE";
break;
case MYPEAR_ORGID_KTH:
$em["nw_employment_inst"] = "KTH Royal Institute of Technology";
$em["nw_employment_country"] = "SE";
break;
case MYPEAR_ORGID_OKC:
$em["nw_employment_inst"] = "Oskar Klein Center";
$em["nw_employment_country"] = "SE";
break;
}
}
if (empty($em["nw_employment_country"])) {
$em["nw_employment_country"] = isset($options["e_cc"]) ? $options["e_cc"] : "";
}
if (isset($options["e_cc"]) && ($k = array_search($options["e_cc"], $countryCodeArray))) {
$em["nw_employment_country"] = $k;
}
$em["nw_employment_isnordic"] = functions::fromCountryCodeTo("continentcode", $em["nw_employment_country"], 1, 0, 0) == "NO" ? 1 : 0;
if (!empty($em["nw_employment_title"])) {
$em["nw_employment_type"] = self::getEmploymentTypeFromTitle($em["nw_employment_title"]);
} elseif (!empty($options["e_rate"])) {
$em["nw_employment_type"] = $options["e_rate"];
} elseif (!empty($udata["nw_employeeType"])) {
$em["nw_employment_type"] = $udata["nw_employeeType"];
//.........这里部分代码省略.........
示例3: getAllValidUsers
public static function getAllValidUsers($ownerUid = 0)
{
$users = $uids = array();
// -- In the unexpected event that the user with UID=$ownerUid cannot be found in the usual ways
$dummyOwnerRecord = array("name" => "dummy", "uid" => $ownerUid, "gecos" => "uid=" . $ownerUid);
// -- Fetch special users from local DB
foreach (auth::getSpecialUsers(TRUE) as $row) {
$users[strtolower(functions::strip_accents($row["gecos"]))] = array("name" => $row["name"], "uid" => $row["uid"], "gecos" => $row["gecos"]);
$uids[$row["uid"]] = 1;
}
// -- Fetch active users from EA
foreach (people::getPeopleArray("all") as $row) {
$name = "";
$row["nw_fullname"] = functions::utf8encode($row["nw_fullname"]);
// Use SU usernames before trying KTH usernames
if (!empty($row["nw_acc_su"])) {
$name = $row["nw_acc_su"];
} elseif (!empty($row["nw_acc_kth"])) {
$name = $row["nw_acc_kth"];
}
// Get UID from local passwd file
$u = posix_getpwnam($name);
if (!empty($u["uid"]) && !preg_match("/20[0-9][0-9]/i", $name)) {
// Not sure what the YYYY test is for
$users[strtolower(functions::strip_accents($row["nw_fullname"]))] = array("name" => $name, "uid" => $u["uid"], "gecos" => $row["nw_fullname"]);
$uids[$u["uid"]] = 1;
}
}
if (!empty($ownerUid) && !in_array($ownerUid, array_keys($uids))) {
$users["~~owner"] = $dummyOwnerRecord;
}
ksort($users);
return $users;
}
示例4: OutputEventSlidesfromtalks
public static function OutputEventSlidesfromtalks()
{
$stdout = $code = "";
$eventShortname = $shortname = $oneEventContributions = $contributions = $roomsArray = array();
// ------------------------------------------------------------------------
// Output drop-down list
// ------------------------------------------------------------------------
$stdout .= event::outputEventDropdown(array(), "timetable");
// ------------------------------------------------------------------------
if (!isset($_REQUEST["confid"]) || empty($_REQUEST["confid"])) {
return $stdout;
}
// ------------------------------------------------------------------------
// GPC
// ------------------------------------------------------------------------
// Must be after call to event::outputEventDropdown() where $GLOBALS["confid"] is set.
if (!isset($GLOBALS["confid"])) {
functions::gpc_declare_input("confid", array(), false);
}
if (!empty($GLOBALS["confid"])) {
$confidArray = is_array($GLOBALS["confid"]) ? $GLOBALS["confid"] : array($GLOBALS["confid"]);
}
// ------------------------------------------------------------------------
// Obtain data
// ------------------------------------------------------------------------
foreach ($confidArray as $confid) {
$eventShortname[$confid] = $GLOBALS["documentClass"]->getPathFromAgendaId($confid);
$oneEventContributions[$confid] = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getEventContributions', $confid);
}
// end foreach
$shortname = current($eventShortname);
// Merge all talks to one array
foreach ($oneEventContributions as $confid => $records) {
foreach ($records as $datetime => $event) {
$title = $speaker = $affiliation = $sortname = "";
if (isset($event["title_plain"])) {
$title = $event["title_plain"];
}
if (isset($event["speakers"])) {
$s = current($event["speakers"]);
if (isset($s["nw_fullname"])) {
$speaker = $s["nw_fullname"];
}
if (isset($s["av_institute"])) {
$affiliation = $s["av_institute"];
}
}
$n = explode(" ", $speaker);
if (is_array($n)) {
$sortname = strtolower(functions::strip_accents(array_pop($n)));
}
if (!empty($title) && !empty($speaker)) {
$contributions[$sortname] = array("title" => $title, "speaker" => $speaker);
}
}
}
ksort($contributions);
// ------------------------------------------------------------------------
// Output data
// ------------------------------------------------------------------------
$code .= "<h2 class='title'>SLIDES FROM TALKS</h2>\r\n" . "\r\n" . (empty($contributions) ? "<h4>Slides from talks will be published here later</h4>\r\n\r\n" : "") . "<ul>\r\n" . "\r\n";
foreach ($contributions as $sortname => $data) {
if (count(explode(" ", $data["speaker"])) > 2) {
$code .= "<!-- *** check name sort order and file name *** -->\r\n";
}
$code .= "<!--li style='margin-bottom: 1em;'>\r\n" . "<p><strong>" . $data["speaker"] . "</strong>\r\n" . "<br>\"" . $data["title"] . "\"\r\n" . "<br><a href='http://www.nordita.org/docs/agenda/slides-" . $shortname . "-" . $sortname . ".pdf' style='font-weight: bold;'>Slides</a> (PDF)</p>\r\n" . "</li-->\r\n" . "\r\n";
}
// end foreach
$code .= "</ul>\r\n" . "\r\n";
// ----------------------------
return $stdout . "<pre>" . htmlspecialchars($code) . "</pre>";
}
示例5: adaptRawUserArray
function adaptRawUserArray($userarray = array(), $status = "active")
{
if (empty($userarray)) {
return array();
}
// ------------------------------------------
// MASSAGE DATA IN ARRAY $userarray
// ------------------------------------------
//if (IS_TESTSERVER) debug::rr($userarray);
foreach ($userarray as $usr => $udata) {
// -----------------------------------
// -- Not every user has a value for these fields:
// -----------------------------------
foreach (array("e_gid", "e_inst", "e_off", "e_org", "e_rate", "e_type") as $key) {
if (!isset($udata[$key])) {
$udata[$key] = "";
}
}
// -----------------------------------
// -- Rename field nw_firstname
// -- Rename field nw_lastname
// -----------------------------------
// nw_firstname in maildb: "name"
// nw_lastname in maildb: "namefam"
$udata["nw_firstname"] = isset($udata["av_firstname"]) ? $udata["av_firstname"] : "";
$udata["nw_lastname"] = isset($udata["av_lastname"]) ? $udata["av_lastname"] : "";
// -----------------------------------
// -- Create field nw_namevon = von
// -- Create field nw_vonnamefam = von lastname
// -- Create field nw_fullname = firstname von lastname
// -- Create field nw_fullname_break = firstname<br>von lastname
// -- Create field nw_fullname_reverse = lastname, firstname von
// -- Create field nw_dotname = firstname.von.lastname
// -----------------------------------
// nw_namevon in maildb: "von"
$udata["nw_namevon"] = $udata["av_von"];
$udata["nw_vonnamefam"] = trim($udata["av_von"] . " " . $udata["nw_lastname"]);
$udata["nw_fullname"] = str_replace(" ", " ", str_replace("-", "‑", $udata["nw_firstname"])) . " " . (!empty($udata["av_von"]) ? $udata["av_von"] . " " : "") . str_replace(" ", " ", str_replace("-", "‑", $udata["nw_lastname"]));
$udata["nw_fullname_break"] = str_replace(" ", " ", str_replace("-", "‑", $udata["nw_firstname"])) . "<br>" . (!empty($udata["av_von"]) ? $udata["av_von"] . " " : "") . str_replace(" ", " ", str_replace("-", "‑", $udata["nw_lastname"]));
$udata["nw_fullname_reverse"] = str_replace(" ", " ", preg_replace("/" . (!empty($udata["nw_namevon"]) ? $udata["nw_namevon"] . "\\s*" : "") . "/i", "", str_replace("-", "‑", $udata["nw_lastname"]))) . ", " . str_replace(" ", " ", str_replace("-", "‑", $udata["nw_firstname"])) . (!empty($udata["nw_namevon"]) ? " " . $udata["nw_namevon"] : "");
$udata["nw_fullname_reverse_sortable"] = strtolower(functions::strip_accents($udata["nw_fullname_reverse"]));
$udata["nw_dotname"] = functions::dotName($udata["nw_fullname"]);
if (functions::callMethod('people', 'lib/people', 'getSpecialDotname', $udata["nw_dotname"])) {
$udata["nw_dotname"] = functions::callMethod('people', 'lib/people', 'getSpecialDotname', $udata["nw_dotname"]);
}
// -----------------------------------
// -- Rename field nw_user
// -----------------------------------
// In maildb: "user"
// NB. Can't use field 'av_identity' since it is a comma-separated list of
// various usernames of unknown origin
$udata["nw_user"] = $udata["nw_dotname"];
// -----------------------------------
// -- Rename field nw_id_ea
// -- Rename field nw_id_maildb
// -----------------------------------
// ID in maildb: "m_id"
// ID in ea: "av_id"
$udata["nw_id_ea"] = isset($udata["av_id"]) ? $udata["av_id"] : "";
$udata["nw_id_maildb"] = isset($udata["m_id"]) ? $udata["m_id"] : "";
// -----------------------------------
// -- Rename field nw_localinstitute
// -----------------------------------
// In maildb: "institution"
//TODO: 'av_institute' not reliable!
$udata["nw_localinstitute"] = isset($udata["av_institute"]) ? strtolower($udata["av_institute"]) : "";
$ins = explode(",", $udata["nw_localinstitute"]);
$insAll = array();
foreach ($ins as $item) {
switch ($item) {
case "nordita":
$insAll[] = "NOR";
break;
case "fysikum":
$insAll[] = "FKM";
break;
case "albanova":
$insAll[] = "ALB";
break;
case "vetenskapens hus":
case "vetenskapenshus":
$insAll[] = "VH";
break;
}
}
$udata["nw_localinstitute"] = join(",", $insAll);
// -----------------------------------
// -- Rename field nw_institute
// -----------------------------------
// In maildb: ~"institution"
$udata["nw_institute"] = isset($udata["av_institute"]) ? ucfirst($udata["av_institute"]) : "";
// -----------------------------------
// -- Rename field nw_ssn
// -----------------------------------
// In maildb: "pers_number"
$udata["nw_ssn"] = isset($udata["av_ssn"]) ? $udata["av_ssn"] : "";
// -----------------------------------
// -- Rename field nw_birthdate
// -- Create field nw_birthday
// -----------------------------------
//.........这里部分代码省略.........