本文整理汇总了PHP中utf8_deaccent函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_deaccent函数的具体用法?PHP utf8_deaccent怎么用?PHP utf8_deaccent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_deaccent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: renderXml
public function renderXml()
{
$nameSuffix = str_replace(' ', '-', utf8_romanize(utf8_deaccent(ucfirst($this->_params['name']))));
XenForo_Application::autoload('Zend_Debug');
$this->setDownloadFileName('BBM_BbCode_' . $nameSuffix . '.xml');
return $this->_params['xml']->saveXml();
}
开发者ID:Sywooch,项目名称:forums,代码行数:7,代码来源:Export.php
示例2: add
function add()
{
$a = $this->get_macros();
$macros = $_REQUEST['macro'];
$words = $_REQUEST['word'];
foreach ($macros as $key => $value) {
if (isset($value) && trim($value)) {
if (isset($words[$key]) && trim($words[$key])) {
$value = utf8_deaccent($value);
$a[$value] = htmlspecialchars($words[$key], ENT_NOQUOTES, 'UTF-8');
}
}
}
io_saveFile(MACROS_FILE, serialize($a));
return $a;
}
开发者ID:violetfish,项目名称:TextInsert,代码行数:16,代码来源:admin.php
示例3: cleanID
function cleanID($raw_id)
{
$sepchar = "_";
$sepcharpat = '#\\' . $sepchar . '+#';
$id = trim((string) $raw_id);
$id = utf8_strtolower($id);
//alternative namespace seperator
$id = strtr($id, ';', ':');
$id = strtr($id, '/', $sepchar);
$id = utf8_romanize($id);
$id = utf8_deaccent($id, -1);
//remove specials
$id = utf8_stripspecials($id, $sepchar, '\\*');
$id = utf8_strip($id);
$id = preg_replace($sepcharpat, $sepchar, $id);
$id = preg_replace('#:+#', ':', $id);
$id = preg_replace('#:[:\\._\\-]+#', ':', $id);
return $id;
}
开发者ID:ryanmuller,项目名称:folders2web,代码行数:19,代码来源:clean_id.php
示例4: mail_encode_address
/**
* Encodes an email address header
*
* Unicode characters will be deaccented and encoded
* quoted_printable for headers.
* Addresses may not contain Non-ASCII data!
*
* Example:
* mail_encode_address("föö <[email protected]>, [email protected]","TBcc");
*
* @param string $string Multiple adresses separated by commas
* @param string $header Name of the header (To,Bcc,Cc,...)
* @param boolean $names Allow named Recipients?
*/
function mail_encode_address($string, $header = '', $names = true)
{
$headers = '';
$parts = split(',', $string);
foreach ($parts as $part) {
$part = trim($part);
// parse address
if (preg_match('#(.*?)<(.*?)>#', $part, $matches)) {
$text = trim($matches[1]);
$addr = $matches[2];
} else {
$addr = $part;
}
// skip empty ones
if (empty($addr)) {
continue;
}
// FIXME: is there a way to encode the localpart of a emailaddress?
if (!utf8_isASCII($addr)) {
msg(htmlspecialchars("E-Mail address <{$addr}> is not ASCII"), -1);
continue;
}
if (!mail_isvalid($addr)) {
msg(htmlspecialchars("E-Mail address <{$addr}> is not valid"), -1);
continue;
}
// text was given
if (!empty($text) && $names) {
// add address quotes
$addr = "<{$addr}>";
if (defined('MAILHEADER_ASCIIONLY')) {
$text = utf8_deaccent($text);
$text = utf8_strip($text);
}
if (!utf8_isASCII($text)) {
$text = '=?UTF-8?Q?' . mail_quotedprintable_encode($text, 0) . '?=';
}
} else {
$text = '';
}
// add to header comma seperated and in new line to avoid too long headers
if ($headers != '') {
$headers .= ',' . MAILHEADER_EOL . ' ';
}
$headers .= $text . ' ' . $addr;
}
if (empty($headers)) {
return null;
}
//if headername was given add it and close correctly
if ($header) {
$headers = $header . ': ' . $headers . MAILHEADER_EOL;
}
return $headers;
}
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:69,代码来源:mail.php
示例5: array
<?php
if (!empty($_GET['anywhere']) && $_GET['searchtype'] == 'metadata') {
$anywhere_array = array($_GET['anywhere']);
if ($_GET['anywhere_separator'] == 'AND' || $_GET['anywhere_separator'] == 'OR') {
$anywhere_array = explode(' ', $_GET['anywhere']);
}
while ($anywhere = each($anywhere_array)) {
$like_query_esc = str_replace("\\", "\\\\", $anywhere[1]);
$like_query_esc = str_replace("%", "\\%", $like_query_esc);
$like_query_esc = str_replace("_", "\\_", $like_query_esc);
$like_query_esc = str_replace("<*>", "%", $like_query_esc);
$like_query_esc = str_replace("<?>", "_", $like_query_esc);
$author_like_query = $dbHandle->quote("%L:\"{$like_query_esc}%");
$like_query = $dbHandle->quote("%{$like_query_esc}%");
$translation = utf8_deaccent($like_query_esc);
if ($translation != $like_query_esc) {
$author_like_query_translated = $dbHandle->quote("%L:\"{$translation}%");
$like_query_translated = $dbHandle->quote("%{$translation}%");
$like_sql = "authors LIKE {$author_like_query} ESCAPE '\\' OR" . " editor LIKE {$author_like_query} ESCAPE '\\' OR" . " journal LIKE {$like_query} ESCAPE '\\' OR" . " secondary_title LIKE {$like_query} ESCAPE '\\' OR" . " tertiary_title LIKE {$like_query} ESCAPE '\\' OR" . " affiliation LIKE {$like_query} ESCAPE '\\' OR" . " title LIKE {$like_query} ESCAPE '\\' OR" . " abstract LIKE {$like_query} ESCAPE '\\' OR" . " year LIKE {$like_query} ESCAPE '\\' OR" . " id=" . intval($anywhere[1]) . " OR" . " keywords LIKE {$like_query} ESCAPE '\\' OR" . " authors_ascii LIKE {$author_like_query_translated} ESCAPE '\\' OR" . " title_ascii LIKE {$like_query_translated} ESCAPE '\\' OR" . " abstract_ascii LIKE {$like_query_translated} ESCAPE '\\'";
} else {
$like_sql = "authors_ascii LIKE {$author_like_query} ESCAPE '\\' OR" . " editor LIKE {$author_like_query} ESCAPE '\\' OR" . " journal LIKE {$like_query} ESCAPE '\\' OR" . " secondary_title LIKE {$like_query} ESCAPE '\\' OR" . " tertiary_title LIKE {$like_query} ESCAPE '\\' OR" . " affiliation LIKE {$like_query} ESCAPE '\\' OR" . " title_ascii LIKE {$like_query} ESCAPE '\\' OR" . " abstract_ascii LIKE {$like_query} ESCAPE '\\' OR" . " year LIKE {$like_query} ESCAPE '\\' OR" . " id=" . intval($anywhere[1]) . " OR" . " keywords LIKE {$like_query} ESCAPE '\\'";
}
$anywhere_regexp[] = '(' . $like_sql . ')';
}
if ($_GET['anywhere_separator'] == 'AND') {
$search_string = join(' AND ', $anywhere_regexp);
}
if ($_GET['anywhere_separator'] == 'OR') {
$search_string = join(' OR ', $anywhere_regexp);
}
开发者ID:jamesscottbrown,项目名称:i-librarian,代码行数:31,代码来源:quicksearch.php
示例6: _verifyUsername
/**
* Verification callback to check that a username is valid
*
* @param string Username
*
* @return bool
*/
protected function _verifyUsername(&$username)
{
if ($this->isUpdate() && $username === $this->getExisting('username')) {
return true;
// unchanged, always pass
}
// standardize white space in names
$username = preg_replace('/\\s+/u', ' ', $username);
try {
// if this matches, then \v isn't known (appears to be PCRE < 7.2) so don't strip
if (!preg_match('/\\v/', 'v')) {
$newName = preg_replace('/\\v+/u', ' ', $username);
if (is_string($newName)) {
$username = $newName;
}
}
} catch (Exception $e) {
}
$username = trim($username);
$usernameLength = utf8_strlen($username);
$minLength = $this->getOption(self::OPTION_USERNAME_LENGTH_MIN);
$maxLength = $this->getOption(self::OPTION_USERNAME_LENGTH_MAX);
if (!$this->getOption(self::OPTION_ADMIN_EDIT)) {
if ($minLength > 0 && $usernameLength < $minLength) {
$this->error(new XenForo_Phrase('please_enter_name_that_is_at_least_x_characters_long', array('count' => $minLength)), 'username');
return false;
}
if ($maxLength > 0 && $usernameLength > $maxLength) {
$this->error(new XenForo_Phrase('please_enter_name_that_is_at_most_x_characters_long', array('count' => $maxLength)), 'username');
return false;
}
$disallowedNames = $this->getOption(self::OPTION_USERNAME_DISALLOWED_NAMES);
if ($disallowedNames) {
foreach ($disallowedNames as $name) {
$name = trim($name);
if ($name === '') {
continue;
}
if (stripos($username, $name) !== false) {
$this->error(new XenForo_Phrase('please_enter_another_name_disallowed_words'), 'username');
return false;
}
}
}
$matchRegex = $this->getOption(self::OPTION_USERNAME_REGEX);
if ($matchRegex) {
$matchRegex = str_replace('#', '\\#', $matchRegex);
// escape delim only
if (!preg_match('#' . $matchRegex . '#i', $username)) {
$this->error(new XenForo_Phrase('please_enter_another_name_required_format'), 'username');
return false;
}
}
$censoredUserName = XenForo_Helper_String::censorString($username);
if ($censoredUserName !== $username) {
$this->error(new XenForo_Phrase('please_enter_name_that_does_not_contain_any_censored_words'), 'username');
return false;
}
}
// ignore check if unicode properties aren't compiled
try {
if (@preg_match("/\\p{C}/u", $username)) {
$this->error(new XenForo_Phrase('please_enter_name_without_using_control_characters'), 'username');
return false;
}
} catch (Exception $e) {
}
if (strpos($username, ',') !== false) {
$this->error(new XenForo_Phrase('please_enter_name_that_does_not_contain_comma'), 'username');
return false;
}
if (XenForo_Helper_Email::isEmailValid($username)) {
$this->error(new XenForo_Phrase('please_enter_name_that_does_not_resemble_an_email_address'), 'username');
return false;
}
$existingUser = $this->_getUserModel()->getUserByName($username);
if ($existingUser && $existingUser['user_id'] != $this->get('user_id')) {
$this->error(new XenForo_Phrase('usernames_must_be_unique'), 'username');
return false;
}
// compare against romanized name to help reduce confusable issues
$romanized = utf8_deaccent(utf8_romanize($username));
if ($romanized != $username) {
$existingUser = $this->_getUserModel()->getUserByName($romanized);
if ($existingUser && $existingUser['user_id'] != $this->get('user_id')) {
$this->error(new XenForo_Phrase('usernames_must_be_unique'), 'username');
return false;
}
}
return true;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:98,代码来源:User.php
示例7: cleanID
/**
* Remove unwanted chars from ID
*
* Cleans a given ID to only use allowed characters. Accented characters are
* converted to unaccented ones
*
* @author Andreas Gohr <[email protected]>
* @param string $raw_id The pageid to clean
* @param boolean $ascii Force ASCII
* @param boolean $media Allow leading or trailing _ for media files
*/
function cleanID($raw_id, $ascii = false, $media = false)
{
global $conf;
static $sepcharpat = null;
global $cache_cleanid;
$cache =& $cache_cleanid;
// check if it's already in the memory cache
if (isset($cache[(string) $raw_id])) {
return $cache[(string) $raw_id];
}
$sepchar = $conf['sepchar'];
if ($sepcharpat == null) {
// build string only once to save clock cycles
$sepcharpat = '#\\' . $sepchar . '+#';
}
$id = trim((string) $raw_id);
$id = utf8_strtolower($id);
//alternative namespace seperator
$id = strtr($id, ';', ':');
if ($conf['useslash']) {
$id = strtr($id, '/', ':');
} else {
$id = strtr($id, '/', $sepchar);
}
if ($conf['deaccent'] == 2 || $ascii) {
$id = utf8_romanize($id);
}
if ($conf['deaccent'] || $ascii) {
$id = utf8_deaccent($id, -1);
}
//remove specials
$id = utf8_stripspecials($id, $sepchar, '\\*');
if ($ascii) {
$id = utf8_strip($id);
}
//clean up
$id = preg_replace($sepcharpat, $sepchar, $id);
$id = preg_replace('#:+#', ':', $id);
$id = $media ? trim($id, ':.-') : trim($id, ':._-');
$id = preg_replace('#:[:\\._\\-]+#', ':', $id);
$cache[(string) $raw_id] = $id;
return $id;
}
开发者ID:pijoter,项目名称:dokuwiki,代码行数:54,代码来源:pageutils.php
示例8: cleanHeaders
/**
* Cleanup and encode the headers array
*/
protected function cleanHeaders()
{
global $conf;
// clean up addresses
if (empty($this->headers['From'])) {
$this->from($conf['mailfrom']);
}
$addrs = array('To', 'From', 'Cc', 'Bcc', 'Reply-To', 'Sender');
foreach ($addrs as $addr) {
if (isset($this->headers[$addr])) {
$this->headers[$addr] = $this->cleanAddress($this->headers[$addr]);
}
}
if (isset($this->headers['Subject'])) {
// add prefix to subject
if (empty($conf['mailprefix'])) {
if (utf8_strlen($conf['title']) < 20) {
$prefix = '[' . $conf['title'] . ']';
} else {
$prefix = '[' . utf8_substr($conf['title'], 0, 20) . '...]';
}
} else {
$prefix = '[' . $conf['mailprefix'] . ']';
}
$len = strlen($prefix);
if (substr($this->headers['Subject'], 0, $len) != $prefix) {
$this->headers['Subject'] = $prefix . ' ' . $this->headers['Subject'];
}
// encode subject
if (defined('MAILHEADER_ASCIIONLY')) {
$this->headers['Subject'] = utf8_deaccent($this->headers['Subject']);
$this->headers['Subject'] = utf8_strip($this->headers['Subject']);
}
if (!utf8_isASCII($this->headers['Subject'])) {
$this->headers['Subject'] = '=?UTF-8?B?' . base64_encode($this->headers['Subject']) . '?=';
}
}
}
开发者ID:boycaught,项目名称:dokuwiki,代码行数:41,代码来源:Mailer.class.php
示例9: _getUrlVersionOfTag
protected function _getUrlVersionOfTag($tag)
{
$db = $this->_getDb();
$urlVersion = preg_replace('/[^a-zA-Z0-9_ -]/', '', utf8_romanize(utf8_deaccent($tag)));
$urlVersion = preg_replace('/[ -]+/', '-', $urlVersion);
if (!strlen($urlVersion)) {
$urlVersion = 1 + intval($db->fetchOne("\r\n\t\t\t\tSELECT MAX(tag_id)\r\n\t\t\t\tFROM xf_tag\r\n\t\t\t"));
} else {
$existing = $db->fetchRow("\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM xf_tag\r\n\t\t\t\tWHERE tag_url = ?\r\n\t\t\t\t\tOR (tag_url LIKE ? AND tag_url REGEXP ?)\r\n\t\t\t\tORDER BY tag_id DESC\r\n\t\t\t\tLIMIT 1\r\n\t\t\t", array($urlVersion, "{$urlVersion}-%", "^{$urlVersion}-[0-9]+\$"));
if ($existing) {
$counter = 1;
if ($existing['tag_url'] != $urlVersion && preg_match('/-(\\d+)$/', $existing['tag_url'], $match)) {
$counter = $match[1];
}
$testExists = true;
while ($testExists) {
$counter++;
$testExists = $db->fetchOne("\r\n\t\t\t\t\t\tSELECT tag_id\r\n\t\t\t\t\t\tFROM xf_tag\r\n\t\t\t\t\t\tWHERE tag_url = ?\r\n\t\t\t\t\t", "{$urlVersion}-{$counter}");
}
$urlVersion .= "-{$counter}";
}
}
return $urlVersion;
}
开发者ID:darkearl,项目名称:projectT122015,代码行数:24,代码来源:Tag.php
示例10: str_pad
$stmt->bindParam(':authors_ascii', $authors_ascii, PDO::PARAM_STR);
$stmt->bindParam(':title_ascii', $title_ascii, PDO::PARAM_STR);
$stmt->bindParam(':abstract_ascii', $abstract_ascii, PDO::PARAM_STR);
$stmt->bindParam(':added_by', $userID, PDO::PARAM_INT);
$dbHandle->exec("BEGIN IMMEDIATE TRANSACTION");
$stmt->execute();
$stmt = null;
$id = $dbHandle->lastInsertId();
$new_file = str_pad($id, 5, "0", STR_PAD_LEFT) . '.pdf';
// Save citation key.
$stmt6 = $dbHandle->prepare("UPDATE library SET bibtex=:bibtex WHERE id=:id");
$stmt6->bindParam(':bibtex', $bibtex, PDO::PARAM_STR);
$stmt6->bindParam(':id', $id, PDO::PARAM_INT);
$bibtex_author = 'unknown';
if (!empty($last_name[0])) {
$bibtex_author = utf8_deaccent($last_name[0]);
}
empty($year) ? $bibtex_year = '0000' : ($bibtex_year = substr($year, 0, 4));
$bibtex = $bibtex_author . '-' . $bibtex_year . '-ID' . $id;
$insert = $stmt6->execute();
$insert = null;
if (isset($_GET['shelf']) && !empty($userID)) {
$user_query = $dbHandle->quote($userID);
$file_query = $dbHandle->quote($id);
$dbHandle->exec("INSERT OR IGNORE INTO shelves (userID,fileID) VALUES ({$user_query},{$file_query})");
}
if (isset($_GET['project']) && !empty($_GET['projectID'])) {
$dbHandle->exec("INSERT OR IGNORE INTO projectsfiles (projectID,fileID) VALUES (" . intval($_GET['projectID']) . "," . intval($id) . ")");
}
####### record new category into categories, if not exists #########
if (!empty($_GET['category2'])) {
开发者ID:jamesscottbrown,项目名称:i-librarian,代码行数:31,代码来源:remoteuploader.php
示例11: htmlspecialchars
print "<br><u>External IDs:</u> " . htmlspecialchars(implode(", ", $uids));
print '<br><u>DOI:</u> <span id="file-doi">' . htmlspecialchars($paper['doi']) . '</span>';
if (!empty($paper['bibtex'])) {
print '<br><u>BibTex:</u> <input type="text" class="bibtex" value="' . htmlspecialchars($paper['bibtex']) . '" style="outline:none;width:200px" readonly>';
} else {
$bibtex_author = substr($paper['authors'], 3);
$bibtex_author = substr($bibtex_author, 0, strpos($bibtex_author, '"'));
if (empty($bibtex_author)) {
$bibtex_author = 'unknown';
}
$bibtex_year = '0000';
$bibtex_year_array = explode('-', $paper['year']);
if (!empty($bibtex_year_array[0])) {
$bibtex_year = $bibtex_year_array[0];
}
$bibtex_key = utf8_deaccent($bibtex_author) . '-' . $bibtex_year . '-ID' . $paper['id'];
print '<br><u>BibTex:</u> <input type="text" class="bibtex" value="' . $bibtex_key . '" style="outline:none;width:200px" readonly>';
}
$editor_string = '';
if (!empty($paper['editor'])) {
$array = explode(';', $paper['editor']);
$array = array_filter($array);
if (!empty($array)) {
foreach ($array as $editor) {
$array2 = explode(',', $editor);
$last = trim($array2[0]);
$last = substr($array2[0], 3, -1);
$first = trim($array2[1]);
$first = substr($array2[1], 3, -1);
$new_editor[] = $last . ', ' . $first;
}
开发者ID:fweik,项目名称:i-librarian,代码行数:31,代码来源:file_top.php
示例12: getTitleForUrl
/**
* Gets version of a title that is valid in a URL. Invalid elements are stripped
* or replaced with '-'. It may not be possible to reverse a URL'd title to the
* original title.
*
* @param string $title
* @param boolean $romanize If true, non-latin strings are romanized
*
* @return string
*/
public static function getTitleForUrl($title, $romanize = false)
{
$title = strval($title);
$lookup = $title . ($romanize ? '|r' : '');
if (isset(self::$_titleCache[$lookup])) {
return self::$_titleCache[$lookup];
}
if ($romanize) {
$title = utf8_romanize(utf8_deaccent($title));
}
$aPattern = array("a" => "á|à|ạ|ả|ã|ă|ắ|ằ|ặ|ẳ|ẵ|â|ấ|ầ|ậ|ẩ|ẫ|Á|À|Ạ|Ả|Ã|Ă|Ắ|Ằ|Ặ|Ẳ|Ẵ|Â|Ấ|Ầ|Ậ|Ẩ|Ẫ", "o" => "ó|ò|ọ|ỏ|õ|ô|ố|ồ|ộ|ổ|ỗ|ơ|ớ|ờ|ợ|ở|ỡ|Ó|Ò|Ọ|Ỏ|Õ|Ô|Ố|Ồ|Ộ|Ổ|Ỗ|Ơ|Ớ|Ờ|Ợ|Ở|Ỡ", "e" => "é|è|ẹ|ẻ|ẽ|ê|ế|ề|ệ|ể|ễ|É|È|Ẹ|Ẻ|Ẽ|Ê|Ế|Ề|Ệ|Ể|Ễ", "u" => "ú|ù|ụ|ủ|ũ|ư|ứ|ừ|ự|ử|ữ|Ú|Ù|Ụ|Ủ|Ũ|Ư|Ứ|Ừ|Ự|Ử|Ữ", "i" => "í|ì|ị|ỉ|ĩ|Í|Ì|Ị|Ỉ|Ĩ", "y" => "ý|ỳ|ỵ|ỷ|ỹ|Ý|Ỳ|Ỵ|Ỷ|Ỹ", "d" => "đ|Đ");
while (list($key, $value) = each($aPattern)) {
$title = @ereg_replace($value, $key, $title);
}
$title = strtr($title, '`!"$%^&*()-+={}[]<>;:@#~,./?|' . "\r\n\t\\", ' ' . ' ');
$title = strtr($title, array('"' => '', "'" => ''));
if ($romanize) {
$title = preg_replace('/[^a-zA-Z0-9_ -]/', '', $title);
}
$title = preg_replace('/[ ]+/', '-', trim($title));
$title = strtr($title, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
self::$_titleCache[$lookup] = $title;
return $title;
}
开发者ID:darkearl,项目名称:projectT122015,代码行数:34,代码来源:Link.php
示例13: utf8_deaccent
function utf8_deaccent($string, $case = 0)
{
return utf8_deaccent($string, $case);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:4,代码来源:utf8_integration_test.class.php
示例14: renderXml
public function renderXml()
{
$title = str_replace(' ', '-', utf8_romanize(utf8_deaccent($this->_params['style']['title'])));
$this->setDownloadFileName('style-' . $title . '.xml');
return $this->_params['xml']->saveXml();
}
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:6,代码来源:Export.php
示例15: reset
}
}
reset($add_item);
}
if (isset($add_item['id'])) {
$id_author = substr($item['authors'], 3);
$id_author = substr($id_author, 0, strpos($id_author, '"'));
if (empty($id_author)) {
$id_author = 'unknown';
}
$id_year_array = explode('-', $item['year']);
$id_year = '0000';
if (!empty($id_year_array[0])) {
$id_year = $id_year_array[0];
}
$add_item['id'] = utf8_deaccent($id_author) . '-' . $id_year . '-ID' . $item['id'];
if ($_GET['format'] == 'BibTex' && !empty($item['bibtex'])) {
$add_item['id'] = $item['bibtex'];
}
$add_item['id'] = str_replace(' ', '', $add_item['id']);
}
if ($_GET['format'] == 'list') {
$new_authors = array();
$array = explode(';', $item['authors']);
$array = array_filter($array);
if (!empty($array)) {
foreach ($array as $author) {
$array2 = explode(',', $author);
$last = trim($array2[0]);
$last = substr($array2[0], 3, -1);
$first = trim($array2[1]);
开发者ID:fweik,项目名称:i-librarian,代码行数:31,代码来源:export.php
示例16: getTitleForUrl
/**
* Gets version of a title that is valid in a URL. Invalid elements are stripped
* or replaced with '-'. It may not be possible to reverse a URL'd title to the
* original title.
*
* @param string $title
* @param boolean $romanize If true, non-latin strings are romanized
*
* @return string
*/
public static function getTitleForUrl($title, $romanize = false)
{
$title = strval($title);
$lookup = $title . ($romanize ? '|r' : '');
if (isset(self::$_titleCache[$lookup])) {
return self::$_titleCache[$lookup];
}
if ($romanize) {
$title = utf8_romanize(utf8_deaccent($title));
}
$title = strtr($title, '`!"$%^&*()-+={}[]<>;:@#~,./?|' . "\r\n\t\\", ' ' . ' ');
$title = strtr($title, array('"' => '', "'" => ''));
if ($romanize) {
$title = preg_replace('/[^a-zA-Z0-9_ -]/', '', $title);
}
$title = preg_replace('/[ ]+/', '-', trim($title));
$title = strtr($title, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
self::$_titleCache[$lookup] = $title;
return $title;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:30,代码来源:Link.php
示例17: empty
empty($_POST['bibtex_type']) ? $bibtex_type = '' : ($bibtex_type = trim($_POST['bibtex_type']));
$added_by = $user_id;
########## get the new filename and record item ##########
$dbHandle->exec("BEGIN IMMEDIATE TRANSACTION");
if (!empty($title)) {
$insert = $stmt->execute();
}
$stmt = null;
$id = $dbHandle->lastInsertId();
$new_file = str_pad($id, 5, "0", STR_PAD_LEFT) . '.pdf';
// Save default citation key.
if (empty($_POST['bibtex'])) {
$stmt = $dbHandle->prepare("UPDATE library SET bibtex=:bibtex WHERE id=:id");
$stmt->bindParam(':bibtex', $bibtex, PDO::PARAM_STR);
$stmt->bindParam(':id', $id, PDO::PARAM_INT);
empty($_POST['last_name'][0]) ? $bibtex_author = 'unknown' : ($bibtex_author = utf8_deaccent($_POST['last_name'][0]));
empty($_POST['year']) ? $bibtex_year = '0000' : ($bibtex_year = substr($_POST['year'], 0, 4));
$bibtex = $bibtex_author . '-' . $bibtex_year . '-ID' . $id;
$stmt->execute();
}
$dbHandle->exec("COMMIT");
if ($insert == false) {
$error[] = htmlspecialchars('Error! The item has not been recorded.<br>' . $title);
}
if ($insert == true) {
$message[] = htmlspecialchars('The item has been recorded.<br>' . $title);
}
####### record new category into categories, if not exists #########
$category_ids = array();
if (!empty($_POST['category2'])) {
$_POST['category2'] = preg_replace('/\\s{2,}/', '', $_POST['category2']);
开发者ID:jamesscottbrown,项目名称:i-librarian,代码行数:31,代码来源:upload.php
示例18: getTitleForUrl
/**
* Gets version of a title that is valid in a URL. Invalid elements are stripped
* or replaced with '-'. It may not be possible to reverse a URL'd title to the
* original title.
*
* @param string $title
* @param boolean $romanize If true, non-latin strings are romanized
*
* @return string
*/
public static function getTitleForUrl($title, $romanize = false)
{
if ($romanize) {
$title = utf8_romanize(utf8_deaccent($title));
}
$title = strtr($title, '`!"$%^&*()-+={}[]<>;:@#~,./?|' . "\r\n\t\\", ' ' . ' ');
$title = strtr($title, array('"' => '', "'" => ''));
$title = preg_replace('/[ ]+/', '-', trim($title));
return strtr($title, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
}
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:20,代码来源:Link.php
示例19: join
#if ($_GET['fulltext_separator'] == 'AND') $search_string = join (' ', $fulltext_array);
while ($fulltext = each($fulltext_array)) {
$like_query = str_replace("\\", "\\\\", $fulltext[1]);
$like_query = str_replace("%", "\\%", $like_query);
$like_query = str_replace("_", "\\_", $like_query);
$like_query = str_replace("<*>", "%", $like_query);
$like_query = str_replace("<?>", "_", $like_query);
$regexp_query = addcslashes($fulltext[1], "\$(..+./<>?[\\^{|");
$regexp_query = str_replace('\\<\\*\\>', '.*', $regexp_query);
$regexp_query = str_replace('\\<\\?\\>', '.?', $regexp_query);
$like_query = $dbHandle->quote("%{$like_query}%");
$regexp_query = str_replace("'", "''", $regexp_query);
$translation = utf8_deaccent($like_query);
if ($translation != $like_query) {
$like_query_translated = $translation;
$regexp_query_translated = utf8_deaccent($regexp_query);
$like_sql = "full_text LIKE {$like_query} ESCAPE '\\' OR full_text LIKE {$like_query_translated} ESCAPE '\\'";
$regexp_sql = "regexp_match(full_text, '{$regexp_query}', {$case2}) OR regexp_match(full_text, '{$regexp_query_translated}', {$case2})";
} else {
$like_sql = "full_text LIKE {$like_query} ESCAPE '\\'";
$regexp_sql = "regexp_match(full_text, '{$regexp_query}', {$case2})";
}
if ($whole_words == 1) {
$fulltext_regexp[] = '(' . $like_sql . ') AND (' . $regexp_sql . ')';
} else {
$fulltext_regexp[] = '(' . $like_sql . ')';
}
}
if ($_GET['fulltext_separator'] == 'AND') {
$search_string = join(' AND ', $fulltext_regexp);
}
开发者ID:jamesscottbrown,项目名称:i-librarian,代码行数:31,代码来源:advancedsearch.php
示例20: utf8_deaccent
$authors_ascii = utf8_deaccent($authors);
}
empty($_POST['affiliation']) ? $affiliation = '' : ($affiliation = $_POST['affiliation']);
$title = $_POST['title'];
$title_ascii = utf8_deaccent($title);
empty($_POST['journal_abbr']) ? $journal = '' : ($journal = $_POST['journal_abbr']);
empty($_POST['secondary_title']) ? $secondary_title = '' : ($secondary_title = $_POST['secondary_title']);
empty($_POST['tertiary_title']) ? $tertiary_title = '' : ($tertiary_title = $_POST['tertiary_title']);
empty($_POST['year']) ? $year = '' : ($year = $_POST['year']);
$addition_date = date('Y-m-d');
if (empty($_POST['abstract'])) {
$abstract = '';
$abstract_ascii = '';
} else {
$abstract = $_POST['abstract'];
$abstract_ascii = utf8_deaccent($abstract);
}
empty($_POST['rating']) ? $rating = '2' : ($rating = $_POST['rating']);
empty($_POST['uid'][0]) ? $uid = '' : ($uid = join('|', array_filter($_POST['uid'])));
empty($_POST['volume']) ? $volume = '' : ($volume = $_POST['volume']);
empty($_POST['issue']) ? $issue = '' : ($issue = $_POST['issue']);
empty($_POST['pages']) ? $pages = '' : ($pages = $_POST['pages']);
empty($_POST['editor']) ? $editor = '' : ($editor = $_POST['editor']);
empty($_POST['url'][0]) ? $url = '' : ($url = join('|', array_filter($_POST['url'])));
empty($_POST['reference_type']) ? $reference_type = 'article' : ($reference_type = $_POST['reference_type']);
empty($_POST['publisher']) ? $publisher = '' : ($publisher = $_POST['publisher']);
empty($_POST['place_published']) ? $place_published = '' : ($place_published = $_POST['place_published']);
if (empty($_POST['keywords'])) {
$keywords = '';
} else {
$keywords = $_POST['keywords'];
开发者ID:fweik,项目名称:i-librarian,代码行数:31,代码来源:upload.php
注:本文中的utf8_deaccent函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论