本文整理汇总了PHP中remove_accents函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_accents函数的具体用法?PHP remove_accents怎么用?PHP remove_accents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_accents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_tribe_events_category_slug
/**
* Filters the `tribe_events_category_slug` to return the category slug that's WPML aware.
*
* WPML does not currently support translation of custom taxonomies root ,e.g. `category` in
* The Events Calendar case. But we do take WPML-managed translations of the `category` slug
* into account in our rewrite rules and try to show a localized version of the `category` slug
* in the permalinks.
*
* @param string $slug The original, possibily translated, category slug.
*
* @return string The category slug in its ENG form if the Events Category translation is not active
* or in a translation that The Events Calendar supports.
*/
public function filter_tribe_events_category_slug($slug)
{
/** @var SitePress $sitepress */
global $sitepress;
$tax_sync_options = $sitepress->get_setting('taxonomies_sync_option');
$translate_event_cat = !empty($tax_sync_options[Tribe__Events__Main::TAXONOMY]);
$using_lang_query_var = $sitepress->get_setting('language_negotiation_type') == 3;
if (!$translate_event_cat || $using_lang_query_var) {
$slug = 'category';
} else {
$lang = $sitepress->get_locale(ICL_LANGUAGE_CODE);
$tec_translation = Tribe__Events__Integrations__WPML__Utils::get_wpml_i18n_strings(array('category'), $lang);
$slug = !empty($tec_translation[0]) ? end($tec_translation[0]) : $slug;
$remove_accents = true;
/**
* Whether accents should be removed from the translated slug or not.
*
* Returning a falsy value here will prevent accents from being removed.
* E.g. "catégorie" would become "categorie" if this filter value is truthy;
* it would instead remain unchanged if this filters returns a falsy value.
*
* @param bool $remove_accents Defaults to `true`.
*/
$remove_accents = apply_filters('tribe_events_integrations_category_slug_remove_accents', $remove_accents);
if ($remove_accents) {
$slug = remove_accents(urldecode($slug));
}
}
return $slug;
}
示例2: make_url
function make_url($string)
{
$ci = load_ci();
$string = remove_accents($string);
//$string = htmlspecialchars($string);
$string = strtolower($string);
// Force lowercase
$space_chars = array(" ", "…", "–", "—", "/", "\\", ":", ";", ".", "+", "#", "~", "_", "|");
foreach ($space_chars as $char) {
$string = str_replace($char, '-', $string);
// Change spaces to dashes
}
// Only allow letters, numbers, and dashes
$string = preg_replace('/([^a-zA-Z0-9\\-]+)/', '', $string);
$string = preg_replace('/-+/', '-', $string);
// Clean up extra dashes
if (substr($string, -1) === '-') {
// Remove - from end
$string = substr($string, 0, -1);
}
if (substr($string, 0, 1) === '-') {
// Remove - from start
$string = substr($string, 1);
}
return $string;
}
示例3: osc_sanitizeString
function osc_sanitizeString($string) {
$string = strip_tags($string);
$string = preg_replace('/%([a-fA-F0-9][a-fA-F0-9])/', '--$1--', $string);
$string = str_replace('%', '', $string);
$string = preg_replace('/--([a-fA-F0-9][a-fA-F0-9])--/', '%$1', $string);
$string = remove_accents($string);
$string = strtolower($string);
// @TODO retrieve $arr_stop_words from Locale user custom list. as editable in /oc-admin/index.php?page=languages
// and do a
// str_replace($arr_stop_words, '', $string);
$string = preg_replace('/&.+?;/', '', $string);
$string = str_replace(array('.','\'','--'), '-', $string);
$string = preg_replace('/\s+/', '-', $string);
$string = preg_replace('|[\p{Ps}\p{Pe}\p{Pi}\p{Pf}\p{Po}\p{S}\p{Z}\p{C}\p{No}]+|u', '', $string);
if( is_utf8($string) ) {
$string = urlencode($string);
// mdash & ndash
$string = str_replace(array('%e2%80%93', '%e2%80%94'), '-', strtolower($string));
}
$string = preg_replace('/-+/', '-', $string);
$string = trim($string, '-');
return $string;
}
示例4: listAccounts
function listAccounts($ipageindex)
{
$this->checkAdmin();
$cond_email = isset($_GET['cond_email']) ? $_GET['cond_email'] : null;
$strWhere = '';
if (isset($cond_email) && $cond_email != '') {
$cond_email = mysql_real_escape_string($cond_email);
$cond_email = strtolower(remove_accents($cond_email));
$strWhere .= " and username like '%{$cond_email}%'";
}
$this->account->orderBy('id', 'desc');
$this->account->where($strWhere);
$this->account->setPage($ipageindex);
$this->account->setLimit(PAGINATE_LIMIT);
$lstAccounts = $this->account->search();
$totalPages = $this->account->totalPages();
$ipagesbefore = $ipageindex - INT_PAGE_SUPPORT;
if ($ipagesbefore < 1) {
$ipagesbefore = 1;
}
$ipagesnext = $ipageindex + INT_PAGE_SUPPORT;
if ($ipagesnext > $totalPages) {
$ipagesnext = $totalPages;
}
$this->set('lstAccounts', $lstAccounts);
$this->set('pagesindex', $ipageindex);
$this->set('pagesbefore', $ipagesbefore);
$this->set('pagesnext', $ipagesnext);
$this->set('pageend', $totalPages);
$this->_template->renderPage();
}
示例5: sanitize_title_with_dashes
function sanitize_title_with_dashes($title)
{
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);
// Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
$title = remove_accents($title);
if (!mb_check_encoding($title, 'UTF-8')) {
if (function_exists('mb_strtolower')) {
$title = mb_strtolower($title, 'UTF-8');
}
$title = urlencode($title);
}
$title = strtolower($title);
$title = preg_replace('/&.+?;/', '', $title);
// kill entities
$title = str_replace('.', '-', $title);
$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
$title = preg_replace('/\\s+/', '-', $title);
$title = preg_replace('|-+|', '-', $title);
$title = trim($title, '-');
return $title;
}
示例6: get_uri
function get_uri($title)
{
$title = strip_tags($title);
// Preserve escaped octets.
//$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
//$title = str_replace('%', '', $title);
// Restore octets.
//$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
$title = remove_accents($title);
$title = mb_strtolower($title, 'UTF-8');
$title = preg_replace('/&.+?;/', '', $title);
// kill entities
//$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
$title = preg_replace('/[\\W¿¡]+/u', '-', $title);
$title = preg_replace('/[^a-z0-9,;:\\]\\[\\(\\)\\. _-]/', '', $title);
$title = preg_replace('/\\.+$|^\\.+/', '', $title);
$title = preg_replace('/\\.+-|-\\.+/', '-', $title);
$title = preg_replace('|-+|', '-', $title);
$title = remove_shorts($title);
$words = preg_split('/-/', $title);
$uri = '';
foreach ($words as $word) {
if (!empty($word) && $word != '-' && strlen($word) + strlen($uri) < 65) {
$uri .= $word . '-';
}
}
if (strlen($uri) < 5) {
// Just in case if there were no short words
$uri = substr($title, 0, 50);
}
$uri = trim($uri, '-');
return $uri;
}
示例7: format_uri
/**
* Format URI
*
* Formats a category uri.
*
* @param string $cat_uri The uri name
* @uses check_uri
* @uses remove_accents
* @uses seems_utf8
* @uses utf8_uri_encode
* @uses format_uri
* @return string A cleaned uri
*/
function format_uri($cat_uri, $i = 0, $cat_id = false)
{
$cat_uri = strip_tags($cat_uri);
// Preserve escaped octets.
$cat_uri = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $cat_uri);
// Remove percent signs that are not part of an octet.
$cat_uri = str_replace('%', '', $cat_uri);
// Restore octets.
$cat_uri = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $cat_uri);
$cat_uri = remove_accents($cat_uri);
if (seems_utf8($cat_uri)) {
if (function_exists('mb_strtolower')) {
$cat_uri = mb_strtolower($cat_uri, 'UTF-8');
}
$cat_uri = utf8_uri_encode($cat_uri, 200);
}
$cat_uri = strtolower($cat_uri);
$cat_uri = preg_replace('/&.+?;/', '', $cat_uri);
// kill entities
$cat_uri = preg_replace('/[^%a-z0-9 _-]/', '', $cat_uri);
$cat_uri = preg_replace('/\\s+/', '-', $cat_uri);
$cat_uri = preg_replace('|-+|', '-', $cat_uri);
$cat_uri = trim($cat_uri, '-');
if ($i > 0) {
$cat_uri = $cat_uri . "-" . $i;
}
if (!$this->check_uri($cat_uri, $cat_id)) {
$i++;
$cat_uri = $this->format_uri($cat_uri, $i);
}
return $cat_uri;
}
示例8: remove_accents
/**
* Removes all accents from string
* @param string $filename - any filename with absolute path
* @param bool $sanitize - Sanitized all special characters as well?
*/
public static function remove_accents($filename, $sanitize = true)
{
# Get path and basename
$file_info = pathinfo($filename);
$filename = $file_info['basename'];
# If available remove all NFD characters before doing anything else
if (class_exists('Normalizer')) {
$filename = Normalizer::normalize($filename, Normalizer::FORM_C);
}
# Removes accents using wordpress function
$filename = remove_accents($filename);
if ($sanitize) {
# Sanitize special characters for files so that they work in urls
$filename = sanitize_file_name($filename);
}
# And then just remove anything fancy like ¼ and ™
$filename = self::remove_non_ascii_characters($filename);
# If this was full path return it like it was before
# pathinfo returns . for only filenames
if ($file_info['dirname'] != '.') {
$filename = $file_info['dirname'] . '/' . $filename;
}
# Return full path
return $filename;
}
示例9: executeView
public function executeView()
{
sfLoader::loadHelpers(array('General', 'MetaLink'));
parent::executeView();
// we get the user (id + name) who first uploaded this picture:
$this->creator = $this->document->getCreator();
$this->image_type = $this->document['image_type'];
if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
// here, we add the summit name to route names :
$associated_routes = array_filter($this->associated_docs, array('c2cTools', 'is_route'));
$associated_routes = Route::addBestSummitName($associated_routes, $this->__(' :') . ' ');
$associated_docs = array_filter($this->associated_docs, array('c2cTools', 'is_not_route'));
$associated_docs = array_filter($associated_docs, array('c2cTools', 'is_not_image'));
$associated_docs = array_merge($associated_docs, $associated_routes);
// sort by document type, name
if (!empty($associated_docs)) {
foreach ($associated_docs as $key => $row) {
$module[$key] = $row['module'];
$name[$key] = remove_accents($row['name']);
}
array_multisort($module, SORT_STRING, $name, SORT_STRING, $associated_docs);
}
$this->associated_documents = $associated_docs;
// add linked docs areas (except users and images)
$parent_ids = array();
$associated_areas = array();
foreach ($this->associated_docs as $doc) {
if (!in_array($doc['module'], array('images', 'users'))) {
$parent_ids[] = $doc['id'];
}
}
if (count($parent_ids)) {
$prefered_cultures = $this->getUser()->getCulturesForDocuments();
$associated_docs_areas = GeoAssociation::findAreasWithBestName($parent_ids, $prefered_cultures);
$associated_areas = $this->associated_areas;
$areas_ids = array();
foreach ($associated_areas as $area) {
$areas_ids[] = $area['id'];
}
foreach ($associated_docs_areas as $area) {
if (!in_array($area['id'], $areas_ids)) {
$associated_areas[] = $area;
}
}
}
$this->associated_areas = $associated_areas;
$related_portals = array();
$activities = $this->document->get('activities');
if (in_array(5, $activities)) {
$related_portals[] = 'ice';
}
Portal::getLocalPortals($related_portals, $associated_areas);
$this->related_portals = $related_portals;
// link for facebook
list($image_name, $image_ext) = Images::getFileNameParts($this->document['filename']);
$image_url = DIRECTORY_SEPARATOR . sfConfig::get('app_upload_dir') . DIRECTORY_SEPARATOR . sfConfig::get('app_images_directory_name') . DIRECTORY_SEPARATOR . $image_name . 'SI' . $image_ext;
addMetaLink('image_src', $image_url);
}
}
示例10: sanitize_name
/**
* convert_cyr_string accentued letters, spaces, ... to a valid filename format
*/
function sanitize_name($string)
{
// iconv needs locale install on server.
// setlocale(LC_ALL, 'en_GB');
// $sanitized = iconv('UTF-8', 'ASCII//TRANSLIT', $name);
$sanitized = remove_accents($string);
$sanitized = preg_replace("/[^a-zA-Z0-9]/", "_", $sanitized);
return preg_replace("/_+/", "_", $sanitized);
}
示例11: slugify
function slugify($text)
{
$text = remove_accents($text);
$text = str_replace('&', 'y', $text);
$text = preg_replace('/[^[a-z0-9]]*/si', '', $text);
$text = preg_replace('/\\W+/', '', $text);
$text = strtolower(trim($text, ''));
return $text;
}
示例12: slugify
/**
* Slugifies string:
* - Removes accents
* - Converts everything to lowercase
* - Replaces white spaces with a separator; default separator is underscore
*
* @param string $string String to modify
* @param array $options Slugification options
* @return string Slugified string
*/
public static function slugify($string, $options = array("separator" => "_"))
{
// Remove any accented characters
$string = \remove_accents($string);
// Make it all lowercase
$string = \strtolower($string);
// Replace white spaces
$string = \preg_replace("/ /", $options["separator"], $string);
return $string;
}
示例13: wfu_upload_plugin_clean
function wfu_upload_plugin_clean($label)
{
$clean = sanitize_file_name($label);
if (WFU_VAR("WFU_SANITIZE_FILENAME_MODE") != "loose") {
$search = array('@[^a-zA-Z0-9._]@');
$replace = array('-');
$clean = preg_replace($search, $replace, remove_accents($clean));
}
return $clean;
}
示例14: hesk_cleanFileName
function hesk_cleanFileName($filename)
{
$special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "\$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));
/* ' */
$filename = str_replace($special_chars, '', $filename);
$filename = preg_replace('/[\\s-]+/', '-', $filename);
$filename = trim($filename, '.-_');
$filename = remove_accents($filename);
return $filename;
}
示例15: save_to
public function save_to($filename = false)
{
if ($this->snappy) {
if (!$filename) {
$site = current_site();
$filename = strtolower(preg_replace('/\\s+/is', '-', trim(preg_replace('/[^a-z0-9\\s]/is', '', remove_accents($site['name']))))) . '.pdf';
}
$this->snappy->generateFromHtml($this->html, $filename, $this->options, true);
}
}