本文整理汇总了PHP中utf8_normalize函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_normalize函数的具体用法?PHP utf8_normalize怎么用?PHP utf8_normalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_normalize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listBannettesAuto
function listBannettesAuto($filtre_search = "", $id_classement = 0)
{
global $dbh;
if (SESSrights & DSI_AUTH) {
$result = array();
//auto = 1 : bannettes automatiques sans contrôle de date
$auto = 1;
$filtre_search = str_replace("*", "%", $filtre_search);
if ($filtre_search) {
$clause = "WHERE nom_bannette like '{$filtre_search}%' and bannette_auto='{$auto}' ";
} else {
$clause = "WHERE bannette_auto='{$auto}' ";
}
// if ($id_classement!=0) $clause.= " and num_classement=0 ";
if ($id_classement > 0) {
$clause .= " and num_classement='{$id_classement}' ";
}
$requete = "SELECT COUNT(1) FROM bannettes {$clause} ";
$res = mysql_query($requete, $dbh);
$nbr_lignes = mysql_result($res, 0, 0);
if ($nbr_lignes) {
$requete = "SELECT id_bannette, nom_bannette, date_last_remplissage, date_last_envoi, proprio_bannette, bannette_auto, nb_notices_diff FROM bannettes {$clause} ORDER BY nom_bannette, id_bannette ";
$res = mysql_query($requete, $dbh);
while ($row = mysql_fetch_assoc($res)) {
$result[] = array("id_bannette" => $row["id_bannette"], "nom_bannette" => utf8_normalize($row["nom_bannette"]), "date_last_remplissage" => $row["date_last_remplissage"], "date_last_envoi" => $row["date_last_envoi"], "proprio_bannette" => $row["proprio_bannette"], "bannette_auto" => $row["bannette_auto"], "nb_notices_diff" => $row["nb_notices_diff"]);
}
}
return $result;
} else {
return array();
}
}
示例2: donorm
function donorm($str)
{
# We exclude a few chars that ICU would not.
$str = preg_replace('/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/', UTF8_REPLACEMENT, $str);
$str = str_replace(UTF8_FFFE, UTF8_REPLACEMENT, $str);
$str = str_replace(UTF8_FFFF, UTF8_REPLACEMENT, $str);
# UnicodeString constructor fails if the string ends with a head byte.
# Add a junk char at the end, we'll strip it off
return rtrim(utf8_normalize($str . "", UNORM_NFC), "");
}
示例3: list_agnostic_repositories
function list_agnostic_repositories($source_id, $notice)
{
$result = array();
$sql = 'SELECT source_id, comment, name FROM connectors_sources WHERE id_connector = \'agnostic\'';
$res = pmb_mysql_query($sql);
while ($row = pmb_mysql_fetch_assoc($res)) {
$result[] = array('id' => $row["source_id"], 'name' => utf8_normalize($row["name"]), 'comment' => utf8_normalize($row["comment"]));
}
return $result;
}
示例4: getLinks
function getLinks($autTable, $id)
{
global $dbh;
if ($autTable <= 0 || $autTable > 8) {
return false;
}
$autlink = new aut_link($autTable, $id);
$results = array();
foreach ($autlink->aut_list as $alink) {
$aresult = array('autlink_to' => utf8_normalize($alink['to']), 'autlink_to_id' => utf8_normalize($alink['to_num']), 'autlink_to_libelle' => utf8_normalize($alink['libelle']), 'autlink_type' => utf8_normalize($alink['type']), 'autlink_reciproc' => utf8_normalize($alink['reciproc']), 'autlink_comment' => utf8_normalize($alink['comment']));
$results[] = $aresult;
}
return $results;
}
示例5: listEntrepotSources
function listEntrepotSources()
{
global $dbh;
if (SESSrights & ADMINISTRATION_AUTH) {
$result = array();
$requete = "select source_id, id_connector, comment, name from connectors_sources where repository=1";
$res = mysql_query($requete) or die(mysql_error());
while ($row = mysql_fetch_assoc($res)) {
$result[] = array("source_id" => $row["source_id"], "id_connector" => utf8_normalize($row["id_connector"]), "comment" => utf8_normalize($row["comment"]), "name_connector_in" => utf8_normalize($row["name"]));
}
return $result;
} else {
return array();
}
}
示例6: get_publisher_information
function get_publisher_information($publisher_id)
{
global $dbh;
global $msg;
$result = array();
$publisher_id += 0;
if (!$publisher_id) {
throw new Exception("Missing parameter: publisher_id");
}
$sql = "SELECT * FROM publishers WHERE ed_id = " . $publisher_id;
$res = pmb_mysql_query($sql);
if (!$res) {
throw new Exception("Not found: publisher_id = " . $publisher_id);
}
$row = pmb_mysql_fetch_assoc($res);
$result = array("publisher_id" => $row["ed_id"], "publisher_name" => utf8_normalize($row["ed_name"]), "publisher_address1" => utf8_normalize($row["ed_adr1"]), "publisher_address2" => utf8_normalize($row["ed_adr2"]), "publisher_zipcode" => utf8_normalize($row["ed_cp"]), "publisher_city" => utf8_normalize($row["ed_ville"]), "publisher_country" => utf8_normalize($row["ed_pays"]), "publisher_web" => utf8_normalize($row["ed_web"]), "publisher_comment" => utf8_normalize($row["ed_comment"]), "publisher_links" => $this->proxy_parent->pmbesAutLinks_getLinks(3, $publisher_id));
return $result;
}
示例7: get_author_information
function get_author_information($author_id)
{
global $dbh;
global $msg;
$result = array();
$author_id += 0;
if (!$author_id) {
throw new Exception("Missing parameter: author_id");
}
$sql = "SELECT * FROM authors WHERE author_id = " . $author_id;
$res = pmb_mysql_query($sql);
if (!$res) {
throw new Exception("Not found: author_id = " . $author_id);
}
$row = pmb_mysql_fetch_assoc($res);
$result = array("author_id" => $row["author_id"], "author_type" => $row["author_type"], "author_name" => utf8_normalize($row["author_name"]), "author_rejete" => utf8_normalize($row["author_rejete"]), "author_see" => $row["author_see"], "author_date" => utf8_normalize($row["author_date"]), "author_web" => utf8_normalize($row["author_web"]), "author_comment" => utf8_normalize($row["author_comment"]), "author_lieu" => utf8_normalize($row["author_lieu"]), "author_ville" => utf8_normalize($row["author_ville"]), "author_pays" => utf8_normalize($row["author_pays"]), "author_subdivision" => utf8_normalize($row["author_subdivision"]), "author_numero" => utf8_normalize($row["author_numero"]));
if (method_exists($this->proxy_parent, "pmbesAutLinks_getLinks")) {
$result['author_links'] = $this->proxy_parent->pmbesAutLinks_getLinks(1, $author_id);
} else {
$result['author_links'] = array();
}
return $result;
}
示例8: envCheckLibicu
/**
* Check the libicu version
*/
protected function envCheckLibicu()
{
$utf8 = function_exists('utf8_normalize');
$intl = function_exists('normalizer_normalize');
/**
* This needs to be updated something that the latest libicu
* will properly normalize. This normalization was found at
* http://www.unicode.org/versions/Unicode5.2.0/#Character_Additions
* Note that we use the hex representation to create the code
* points in order to avoid any Unicode-destroying during transit.
*/
$not_normal_c = $this->unicodeChar("FA6C");
$normal_c = $this->unicodeChar("242EE");
$useNormalizer = 'php';
$needsUpdate = false;
/**
* We're going to prefer the pecl extension here unless
* utf8_normalize is more up to date.
*/
if ($utf8) {
$useNormalizer = 'utf8';
$utf8 = utf8_normalize($not_normal_c, UtfNormal::UNORM_NFC);
if ($utf8 !== $normal_c) {
$needsUpdate = true;
}
}
if ($intl) {
$useNormalizer = 'intl';
$intl = normalizer_normalize($not_normal_c, Normalizer::FORM_C);
if ($intl !== $normal_c) {
$needsUpdate = true;
}
}
// Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8', 'config-unicode-using-intl'
if ($useNormalizer === 'php') {
$this->showMessage('config-unicode-pure-php-warning');
} else {
$this->showMessage('config-unicode-using-' . $useNormalizer);
if ($needsUpdate) {
$this->showMessage('config-unicode-update-warning');
}
}
}
示例9: command_waiting
function command_waiting($id_tache, $cmd = '')
{
global $dbh, $msg;
$requete_sql = "select status, commande from taches where id_tache='" . $id_tache . "' and end_at='0000-00-00 00:00:00'";
$result = mysql_query($requete_sql);
if (mysql_num_rows($result) == "1") {
$status = mysql_result($result, 0, "status");
$commande = mysql_result($result, 0, "commande");
} else {
$status = '';
$commande = 0;
}
// une commande a déjà été envoyée auparavant...
if ($commande != '0') {
$cmd = $commande;
}
if ($cmd != '') {
//check command - la commande envoyée est vérifié par rapport au status
foreach ($this->types_taches as $type_tache) {
foreach ($type_tache->states as $state) {
if ($state["id"] == $status) {
foreach ($state["nextState"] as $nextState) {
foreach ($type_tache->commands as $command) {
if ($nextState["command"] == $command["name"]) {
if ($command["id"] == $cmd) {
mysql_query("update taches set commande=" . $cmd . ", next_state='" . constant($nextState["value"]) . "' where id_tache=" . $id_tache, $dbh);
}
}
}
}
}
}
}
}
$rs = mysql_query("select t.start_at, t.commande, p.calc_next_date_deb, p.calc_next_heure_deb \n\t\t\tfrom taches t , planificateur p \n\t\t\twhere t.num_planificateur = p.id_planificateur \n\t\t\tand id_tache=" . $id_tache);
$tpl = "<td id='commande_tache_" . $id_tache . "'>";
if ($rs) {
$row = mysql_fetch_object($rs);
if ($row->start_at == '0000-00-00 00:00:00') {
$tpl .= htmlentities(formatdate($row->calc_next_date_deb), ENT_QUOTES, $charset) . " " . htmlentities($row->calc_next_heure_deb, ENT_QUOTES, $charset);
} else {
if ($row->start_at != '0000-00-00 00:00:00' && $row->commande != NULL) {
$tpl .= utf8_normalize($msg["planificateur_command_{$row->commande}"]);
}
}
}
$tpl .= "</td>";
return $tpl;
}
示例10: getInfoTaskPlanned
function getInfoTaskPlanned($planificateur_id, $active = "")
{
global $dbh;
$result = array();
$planificateur_id += 0;
if (!$planificateur_id) {
throw new Exception("Missing parameter: planificateur_id");
}
if ($active != "") {
$critere = " and statut=" . $active;
} else {
$critere = "";
}
$sql = "SELECT * FROM planificateur WHERE id_planificateur = " . $planificateur_id;
$sql = $sql . $critere;
$res = pmb_mysql_query($sql, $dbh);
if (!$res) {
throw new Exception("Not found: planificateur_id = " . $planificateur_id);
}
while ($row = pmb_mysql_fetch_assoc($res)) {
$result[] = array("id_planificateur" => $row["id_planificateur"], "num_type_tache" => $row["num_type_tache"], "libelle_tache" => utf8_normalize($row["libelle_tache"]), "desc_tache" => utf8_normalize($row["desc_tache"]), "num_user" => $row["num_user"], "statut" => $row["statut"], "calc_next_date_deb" => utf8_normalize($row["calc_next_date_deb"]), "calc_next_heure_deb" => utf8_normalize($row["calc_next_heure_deb"]));
}
return $result;
}
示例11: getPublicReadingLists
function getPublicReadingLists($session_id)
{
if (!$session_id) {
return array();
}
$session_info = $this->retrieve_session_information($session_id);
$emprId = $session_info["empr_id"];
if (!$emprId) {
return array();
}
global $dbh;
$sql = "select opac_liste_lecture.*, empr.empr_prenom, empr.empr_nom from opac_liste_lecture left join empr on empr.id_empr = opac_liste_lecture.num_empr where public=1";
$res = mysql_query($sql);
$results = array();
while ($row = mysql_fetch_assoc($res)) {
$aresult = array('reading_list_id' => $row['id_liste'], 'reading_list_name' => utf8_normalize($row['nom_liste']), 'reading_list_caption' => utf8_normalize($row['description']), 'reading_list_emprid' => $row['num_empr'], 'reading_list_empr_caption' => utf8_normalize($row['empr_nom'] . " " . $row['empr_prenom']), 'reading_list_confidential' => $row['confidential'], 'reading_list_public' => $row['public'], 'reading_list_readonly' => $row['read_only'], 'reading_list_notice_ids' => explode(',', $row['notices_associees']));
$results[] = $aresult;
}
return $results;
}
示例12: listExternalSources
function listExternalSources($OPACUserId = -1)
{
global $dbh, $msg;
$sql = 'SELECT connectors_sources.source_id, connectors_sources.name, connectors_sources.comment, connectors_categ.connectors_categ_name FROM connectors_sources LEFT JOIN connectors_categ_sources ON (connectors_categ_sources.num_source = connectors_sources.source_id) LEFT JOIN connectors_categ ON (connectors_categ.connectors_categ_id = connectors_categ_sources.num_categ) WHERE 1 ' . ($OPACUserId != -1 ? 'AND connectors_sources.opac_allowed = 1' : '') . ' ORDER BY connectors_categ.connectors_categ_name, connectors_sources.name';
$res = mysql_query($sql, $dbh);
$results = array();
$categs = array();
while ($row = mysql_fetch_assoc($res)) {
$categs[$row['connectors_categ_name'] ? $row['connectors_categ_name'] : $msg['source_no_category']][] = array('source_id' => $row['source_id'], 'source_caption' => utf8_normalize($row['name']), 'source_comment' => utf8_normalize($row['comment']));
}
foreach ($categs as $categ_name => $categ_content) {
$results[] = array('category_caption' => utf8_normalize($categ_name), 'sources' => $categ_content);
}
return $results;
}
示例13: fetch_item
function fetch_item($item_cb = '', $item_id = '')
{
global $dbh;
global $msg;
global $charset;
if ($this->proxy_parent->input_charset != 'utf-8' && $charset == 'utf-8') {
$item_cb = utf8_encode($item_cb);
} else {
if ($this->proxy_parent->input_charset == 'utf-8' && $charset != 'utf-8') {
$item_cb = utf8_decode($item_cb);
}
}
$empty_result = array('id' => 0, 'cb' => '', 'cote' => '', 'location' => '', 'section' => '', 'support' => '', 'statut' => '', 'situation' => '');
$item_id += 0;
$wheres = array();
if ($item_cb) {
$wheres[] = "expl_cb = '" . addslashes($item_cb) . "'";
}
if ($item_id) {
$wheres[] = "expl_id = " . $item_id . "";
}
$requete = "SELECT exemplaires.*, pret.*, docs_location.*, docs_section.*, docs_statut.*, tdoc_libelle, ";
$requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
$requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
$requete .= " IF(pret_retour>sysdate(),0,1) as retard ";
$requete .= " FROM exemplaires LEFT JOIN pret ON exemplaires.expl_id=pret.pret_idexpl ";
$requete .= " left join docs_location on exemplaires.expl_location=docs_location.idlocation ";
$requete .= " left join docs_section on exemplaires.expl_section=docs_section.idsection ";
$requete .= " left join docs_statut on exemplaires.expl_statut=docs_statut.idstatut ";
$requete .= " left join docs_type on exemplaires.expl_typdoc=docs_type.idtyp_doc ";
$requete .= " WHERE 1 and " . implode(' and ', $wheres);
$res = mysql_query($requete, $dbh);
if (!mysql_numrows($res)) {
return $empty_result;
}
$row = mysql_fetch_assoc($res);
//Je regarde si j'ai les bons droits d'accès
if ($row["expl_notice"]) {
//Si j'ai un exemplaire de monographie
$notice_ids = $this->filter_tabl_notices(array($row["expl_notice"]), "exemplaire");
if (!count($notice_ids) || $notice_ids[0]) {
return $empty_result;
}
} elseif ($row["expl_bulletin"]) {
$bulletin_ids = $this->filter_tabl_bulletins(array($row["expl_bulletin"]), "exemplaire");
if (!count($bulletin_ids) || $bulletin_ids[0]) {
return $empty_result;
}
}
$expl_return = array();
if ($this->expl_visible_opac($row["expl_id"])) {
$expl = new exemplaire('', $row["expl_id"]);
if ($row["pret_retour"]) {
// exemplaire sorti
$rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='" . $row["pret_idempr"] . "' ";
$res_empr = mysql_query($rqt_empr, $dbh);
$res_empr_obj = mysql_fetch_object($res_empr);
$situation = "<strong>{$msg[358]} " . $row["aff_pret_retour"] . "</strong>";
} else {
// tester si réservé
$result_resa = mysql_query("select 1 from resa where resa_cb='" . addslashes($row["expl_cb"]) . "' ", $dbh);
$reserve = mysql_num_rows($result_resa);
if ($reserve) {
$situation = $msg['expl_reserve'];
} elseif ($row["pret_flag"]) {
$situation = "{$msg[359]}";
} else {
$situation = "";
}
}
$expl_return["id"] = $expl->expl_id;
$expl_return["cb"] = $expl->cb;
$expl_return["cote"] = $expl->cote;
$expl_return["location_id"] = $expl->location_id;
$expl_return["location_caption"] = utf8_normalize($row["location_libelle"]);
$expl_return["section_id"] = $expl->section_id;
$expl_return["section_caption"] = utf8_normalize($row["section_libelle"]);
$expl_return["support"] = utf8_normalize($row["tdoc_libelle"]);
$expl_return["statut"] = utf8_normalize($row["statut_libelle"]);
$expl_return["situation"] = utf8_normalize($situation);
}
return $expl_return;
}
示例14: toNFKD
/**
* Convert a UTF-8 string to normal form KD, compatibility decomposition.
* This may cause irreversible information loss, use judiciously.
* Fast return for pure ASCII strings.
*
* @param $string String: a valid UTF-8 string. Input is not validated.
* @return string a UTF-8 string in normal form KD
*/
static function toNFKD($string)
{
if (NORMALIZE_INTL) {
return normalizer_normalize($string, Normalizer::FORM_KD);
} elseif (NORMALIZE_ICU) {
return utf8_normalize($string, UNORM_NFKD);
} elseif (preg_match('/[\\x80-\\xff]/', $string)) {
return UtfNormal::NFKD($string);
} else {
return $string;
}
}
示例15: get_all_locations_and_sections
function get_all_locations_and_sections()
{
global $dbh;
$results = array();
$sql = "SELECT idlocation, location_libelle FROM docs_location WHERE location_visible_opac = 1";
$res = pmb_mysql_query($sql, $dbh);
while ($row = pmb_mysql_fetch_assoc($res)) {
$aresult = array('location' => array("location_id" => $row["idlocation"], "location_caption" => utf8_normalize($row["location_libelle"])), 'sections' => array());
$sql2 = "select idsection, section_libelle, section_pic from docs_section, exemplaires where expl_location=" . $row["idlocation"] . " and section_visible_opac=1 and expl_section=idsection group by idsection order by section_libelle ";
$res2 = pmb_mysql_query($sql2);
$n = 0;
while ($r = pmb_mysql_fetch_object($res2)) {
$asection = array();
$asection["section_id"] = $r->idsection;
$asection["section_location"] = $row["idlocation"];
$asection["section_caption"] = utf8_normalize($r->section_libelle);
$asection["section_image"] = $r->section_pic ? utf8_normalize($r->section_pic) : "images/rayonnage-small.png";
$aresult['sections'][] = $asection;
}
$results[] = $aresult;
}
return $results;
}