本文整理汇总了PHP中convert_accented_characters函数的典型用法代码示例。如果您正苦于以下问题:PHP convert_accented_characters函数的具体用法?PHP convert_accented_characters怎么用?PHP convert_accented_characters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convert_accented_characters函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: urilizeText
public function urilizeText($text, $strip_char = '-')
{
if (!function_exists('stripThing')) {
function stripThing($delimiter, $offset, $strip_char)
{
$newtext = explode($delimiter, $offset);
$e = '';
for ($i = 0; $i < count($newtext); $i++) {
if ($i + 1 == count($newtext)) {
$e .= $newtext[$i];
} else {
$e .= $newtext[$i] . $strip_char;
}
}
return $newtext = strtolower($e);
}
}
$newtext = convert_accented_characters($text);
$newtext = stripThing('\'', $newtext, $strip_char);
$newtext = stripThing(' ', $newtext, $strip_char);
$newtext = stripThing('.', $newtext, $strip_char);
// Removing question mark to avoid security error.
$newtext = stripThing('?', $newtext, $strip_char);
$newtext = stripThing('\\n', $newtext, $strip_char);
return $newtext;
}
示例2: get
function get($filename)
{
$id = $this->input->get('id');
$token = $this->input->get('token');
//Chequeamos permisos del frontend
$file = Doctrine_Query::create()->from('File f, f.Tramite t, t.Etapas e, e.Usuario u')->where('f.id = ? AND f.llave = ? AND u.id = ?', array($id, $token, UsuarioSesion::usuario()->id))->fetchOne();
if (!$file) {
//Chequeamos permisos en el backend
$file = Doctrine_Query::create()->from('File f, f.Tramite.Proceso.Cuenta.UsuariosBackend u')->where('f.id = ? AND f.llave = ? AND u.id = ? AND (u.rol="super" OR u.rol="operacion" OR u.rol="seguimiento")', array($id, $token, UsuarioBackendSesion::usuario()->id))->fetchOne();
if (!$file) {
echo 'Usuario no tiene permisos para ver este archivo.';
exit;
}
}
$path = 'uploads/documentos/' . $file->filename;
if (preg_match('/^\\.\\./', $file->filename)) {
echo 'Archivo invalido';
exit;
}
if (!file_exists($path)) {
echo 'Archivo no existe';
exit;
}
$friendlyName = str_replace(' ', '-', convert_accented_characters(mb_convert_case($file->Tramite->Proceso->Cuenta->nombre . ' ' . $file->Tramite->Proceso->nombre, MB_CASE_LOWER) . '-' . $file->id)) . '.' . pathinfo($path, PATHINFO_EXTENSION);
header('Content-Type: ' . get_mime_by_extension($path));
header('Content-Length: ' . filesize($path));
header('Content-Disposition: attachment; filename="' . $friendlyName . '"');
readfile($path);
}
示例3: VennDiagram
function VennDiagram($names, $abc, $ab, $bc, $ca, $progress = 0)
{
$height = 300;
$width = 400;
$radius = 80;
$shiftx = 55;
$shifty = 45;
$names = convert_accented_characters($names);
$svg = '<div class="img-question text-center">
<svg width="' . $width . '" height="' . $height . '">';
// $svg .= '<rect width="'.$width.'" height="'.$height.'" fill="black" fill-opacity="0.2" />';
// Circles
$svg .= DrawCircle($width / 2 - $shiftx, $height / 2 - $shifty, $radius);
$svg .= DrawCircle($width / 2 + $shiftx, $height / 2 - $shifty, $radius);
$svg .= DrawCircle($width / 2, $height / 2 + $shifty, $radius);
// Labels
$letters = array_map('str_split', $names);
$svg .= DrawText($width / 2 - $shiftx * 2.3, $height / 2 - $shifty * 2.3, '$' . $letters[0][0] . '$', 13);
$svg .= DrawText($width / 2 + $shiftx * 2.3, $height / 2 - $shifty * 2.3, '$' . $letters[1][0] . '$', 13);
$svg .= DrawText($width / 2, $height / 2 + $shifty * 3.2, '$' . $letters[2][0] . '$', 13);
$svg .= $progress >= 1 ? DrawText($width / 2, $height / 2 - 5, '$\\color{red}{' . $abc . '}$', 13) : '';
$svg .= $progress >= 2 ? DrawText($width / 2, $height / 2 - $shifty * 1.2, '$\\color{blue}{' . $ab . '}$', 13) : '';
$svg .= $progress >= 3 ? DrawText($width / 2 + $shiftx * 0.7, $height / 2 + 15, '$\\color{blue}{' . $bc . '}$', 13) : '';
$svg .= $progress >= 4 ? DrawText($width / 2 - $shiftx * 0.7, $height / 2 + 15, '$\\color{blue}{' . $ca . '}$', 13) : '';
$svg .= '</svg></div>';
return $svg;
}
示例4: _slug
function _slug($field)
{
if ($this->edit_slug()) {
return true;
}
if (!empty($this->slug) && $this->slug !== '__generate__') {
return true;
}
$this->load->helper(array('url', 'text', 'string'));
$slug = reduce_multiples(strtolower(url_title(convert_accented_characters($this->title), 'dash')), '-', true);
if (empty($slug)) {
$t = new Album();
$max = $t->select_max('id')->get();
$slug = $max->id + 1;
}
if (is_numeric($slug)) {
$slug = "{$slug}-1";
}
$s = new Slug();
while ($s->where('id', "album.{$slug}")->count() > 0) {
$slug = increment_string($slug, '-');
}
$this->db->query("INSERT INTO {$s->table}(id) VALUES ('album.{$slug}')");
$this->slug = $slug;
}
示例5: get_city
/**
* Renvoie une liste de villes
* en fonction du nom partiel donné
*
*/
function get_city($partial_name = null)
{
//$partial_name = "l'Abergement clémen";
if (isset($_GET['q'])) {
$partial_name = $_GET['q'];
}
//code($partial_name);
$this->load->helper('text');
// la chaîne miniaturisée, les espaces au milieu remplacés par des tirets
$match_elmt = str_replace(' ', '-', strtolower(trim($partial_name)));
$match_elmt = convert_accented_characters($match_elmt);
if (substr($match_elmt, 0, 2) == "l'") {
$match_elmt = substr($match_elmt, 2);
} elseif (substr($match_elmt, 0, 3) == 'le-' || substr($match_elmt, 0, 3) == 'la-') {
$match_elmt = substr($match_elmt, 3);
} elseif (substr($match_elmt, 0, 4) == 'les-') {
$match_elmt = substr($match_elmt, 4);
}
$q = $this->db->select("geo_" . $this->lang . "_city.id, geo_" . $this->lang . "_city.name_city, geo_" . $this->lang . "_city.cp,\r\n geo_" . $this->lang . "_province.name_province")->from("geo_" . $this->lang . "_city")->join('geo_' . $this->lang . "_province", "geo_" . $this->lang . "_province.code = geo_" . $this->lang . "_city.id_province")->like("city_slug", $match_elmt, 'after')->get();
if ($q->num_rows() > 0) {
$result = $q->result();
$arr = array();
foreach ($result as $key => $city) {
$arr[] = "{\"id\": \"" . $city->id . "\", \"value\": \"" . $city->name_city . ', ' . $city->name_province . "\", \"info\": \"\"}";
}
echo "{\"results\": [";
echo implode(', ', $arr);
echo "]}";
} else {
echo 'pas de résultats';
}
}
示例6: update
/**
* Update an existing category
* @access public
* @param int $id The ID of the category
* @param array $input The data to update
* @return bool
*/
public function update($id, $input)
{
return parent::update($id, array(
'title' => $input['title'],
'slug' => url_title(strtolower(convert_accented_characters($input['title'])))
));
}
示例7: get
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function get($genid = '')
{
$id = id_from_genid($genid);
//Kullanıcı izni var mı?
check_perm($id);
$person = $this->db->select('id,name,first_name,last_name,gender,locale')->from('liste')->where('id', $id)->limit('1')->get()->row();
if (!isset($person->id) || $person->id < 1) {
show_error("Information Removed or Not Exists", "410", "Sorry for inconvenience");
}
$person->picture = site_url('picture/large/' . genid_from_id($person->id));
//$person->picture = "http://graph.facebook.com/".$person->id."/picture?type=large";
$data['person'] = $person;
$data['same_last'] = $this->db->select('id,name')->from('liste')->where('last_name', $person->last_name)->where('id !=', $person->id)->limit('28')->get()->result();
$data['same_first'] = $this->db->select('id,name')->from('liste')->where('first_name', $person->first_name)->where('id !=', $person->id)->limit('28')->get()->result();
$data['same_wiki'] = $this->db->select('id,name,short_desc')->from('wiki')->or_where_in('last_name', array($person->first_name, $person->last_name))->limit('28')->get()->result();
//Stats Ekle -> Viewed
stats_add($person->id, "viewed");
//$this->template->set_master_template('template_get');
$this->template->write('title', convert_accented_characters($person->name));
$this->template->write('description', 'about ' . convert_accented_characters($person->name));
$this->template->write('name', convert_accented_characters($person->name));
$this->template->write('image', site_url('picture/square/' . genid_from_id($person->id)));
$this->template->write('picture', $person->picture);
$this->template->write_view('page', 'face/get', $data);
$this->template->render();
}
示例8: _slug
function _slug($field)
{
if ($this->edit_slug()) {
return true;
}
if (!empty($this->old_slug)) {
return true;
}
$this->load->helper(array('url', 'text', 'string'));
if (empty($this->title)) {
$info = pathinfo($this->filename);
$base = $info['filename'];
} else {
$base = $this->title;
}
$slug = reduce_multiples(strtolower(url_title(convert_accented_characters($base), 'dash')), '-', true);
if ($slug === $this->slug) {
return true;
}
if (empty($slug)) {
$t = new Content();
$max = $t->select_max('id')->get();
$slug = $max->id + 1;
}
if (is_numeric($slug)) {
$slug = "{$slug}-1";
}
$s = new Slug();
// Need to lock the table here to ensure that requests arriving at the same time
// still get unique slugs
if ($this->has_db_permission('lock tables')) {
$this->db->query("LOCK TABLE {$s->table} WRITE");
$locked = true;
} else {
$locked = false;
}
while ($s->where('id', "content.{$slug}")->count() > 0) {
$slug = increment_string($slug, '-');
}
$this->db->query("INSERT INTO {$s->table}(id) VALUES ('content.{$slug}')");
if ($locked) {
$this->db->query('UNLOCK TABLES');
}
if (empty($this->old_slug)) {
if (!empty($this->slug) && $this->slug !== '__generate__') {
$this->old_slug = ',' . $this->slug . ',';
} else {
if (!empty($this->title)) {
$this->old_slug = ',' . $slug . ',';
}
}
}
$this->slug = $slug;
}
示例9: img_mapcreator
public function img_mapcreator($sayfa = '')
{
$sayfa = (int) $sayfa;
$data = $this->db->select('id,name')->from('liste')->order_by('primary', 'asc')->limit('1000', $sayfa * 1000)->get()->result();
$cikti = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
foreach ($data as $k) {
$cikti .= '<url><loc>' . base_url() . 'face/get/' . genid_from_id($k->id) . '/' . url_title($k->name) . "</loc><image:image><image:loc>" . site_url('picture/large/' . genid_from_id($k->id)) . "</image:loc><image:title>Photo of " . convert_accented_characters($k->name) . "</image:title></image:image></url>";
}
$cikti .= '</urlset>';
echo $cikti;
}
示例10: create
public function create()
{
$rules = $this->menu_model->rules;
$this->form_validation->set_rules($rules['insert']);
if ($this->form_validation->run() === FALSE) {
$this->render('admin/menus/create_menu_view');
} else {
$title = url_title(convert_accented_characters($this->input->post('title')), '-', TRUE);
if ($this->menu_model->insert(array('title' => $title, 'created_by' => $this->user_id))) {
$this->postal->add('The new menu was created.', 'success');
}
redirect('admin/menus');
}
}
示例11: edit
public function edit($r_id = '')
{
if ($this->functions->get_loged()) {
$this->load->library('form_validation');
$data['user_data'] = $this->functions->get_user_data();
$data['nb_comments'] = $this->functions->get_comments();
$this->form_validation->set_rules('r_title', 'Titre', 'trim|required|callback_check_rubric_title');
$this->form_validation->set_rules('r_description', 'Description', 'trim|required');
$r_title = $this->input->post('r_title');
$r_description = $this->input->post('r_description');
// Add a rubric
if ($this->uri->total_segments() == 3) {
$data['page'] = 'add_rubric';
$data['title'] = 'Ajouter une rubrique';
$r_url_rw = url_title(convert_accented_characters($r_title), '-', TRUE);
if ($this->form_validation->run() !== FALSE) {
$this->model_rubric->create_rubric($r_title, $r_description, $r_url_rw);
$this->session->set_flashdata('success', 'Rubrique "' . $r_title . '" ajoutée');
redirect(base_url(URL_HOME_RUBRIC));
}
} else {
$rubric = $this->model_rubric->get_rubric($r_id, '')->row();
// Rubric exists
if (!empty($rubric)) {
$data['page'] = 'edit_rubric';
$data['content'] = $this->model_content->get_content_by_rubric($r_id);
$data['r_id'] = $r_id;
$data['r_title'] = $rubric->r_title;
$data['r_description'] = $rubric->r_description;
$data['r_url_rw'] = $rubric->r_url_rw;
$data['title'] = 'Modifier la rubrique ' . $data['r_title'];
// Vérification pour l'url
$this->form_validation->set_rules('r_url_rw', 'Url', 'trim|required|callback_check_rubric_url_rw');
$r_url_rw = $this->input->post('r_url_rw');
if ($this->form_validation->run() !== FALSE) {
$this->model_rubric->update_rubric($r_title, $r_description, $r_url_rw, $r_id);
$this->session->set_flashdata('success', 'Rubrique "' . $r_title . '" modifiée.');
redirect(base_url(URL_HOME_RUBRIC));
}
// Rubric unknown
} else {
$this->session->set_flashdata('alert', 'Cette rubrique (#' . $r_id . ') n\'existe plus ou n\'a jamais existé.');
redirect(URL_HOME_RUBRIC);
}
}
$this->load->view(URL_LAYOUT, $data);
}
}
示例12: edit
public function edit($content_id)
{
$content = $this->content_model->get($content_id);
if ($content === FALSE) {
$this->postal->add('There is no content to edit.', 'error');
redirect('admin/contents/index', 'refresh');
}
$this->data['content'] = $content;
$this->data['parents'] = $this->content_model->get_parents_list($content->content_type, $content->id);
$this->data['slugs'] = $this->slug_model->where(array('content_type' => $content->content_type, 'content_id' => $content->id))->get_all();
$rules = $this->content_model->rules;
$this->form_validation->set_rules($rules['update']);
if ($this->form_validation->run() === FALSE) {
$this->render('admin/contents/edit_view');
} else {
$content_id = $this->input->post('content_id');
$content = $this->content_model->get($content_id);
if ($content !== FALSE) {
$parent_id = $this->input->post('parent_id');
$title = $this->input->post('title');
$short_title = $this->input->post('short_title');
$slug = url_title(convert_accented_characters($this->input->post('slug')), '-', TRUE);
$order = $this->input->post('order');
$text = $this->input->post('content');
$teaser = strlen($this->input->post('teaser')) > 0 ? $this->input->post('teaser') : substr($text, 0, strpos($text, '<!--more-->'));
$page_title = strlen($this->input->post('page_title')) > 0 ? $this->input->post('page_title') : $title;
$page_description = strlen($this->input->post('page_description')) > 0 ? $this->input->post('page_description') : ellipsize($teaser, 160);
$page_keywords = $this->input->post('page_keywords');
$published_at = $this->input->post('published_at');
$update_data = array('title' => $title, 'short_title' => $short_title, 'teaser' => $teaser, 'content' => $text, 'page_title' => $page_title, 'page_description' => $page_description, 'page_keywords' => $page_keywords, 'parent_id' => $parent_id, 'published_at' => $published_at, 'order' => $order);
if ($this->content_model->update($update_data, $content_id)) {
if (strlen($slug) > 0) {
$url = $this->_verify_slug($slug);
$new_slug = array('content_type' => $content->content_type, 'content_id' => $content->id, 'url' => $url);
if ($slug_id = $this->slug_model->insert($new_slug)) {
$this->slug_model->where(array('content_type' => $content->content_type, 'id !=' => $slug_id))->update(array('redirect' => $slug_id, 'updated_by' => $this->user_id));
}
}
$this->rat->log('The user edited the content type "' . $content->content_type . '" with the ID: ' . $content->id . ' having "' . $content->title . '" as title.');
$this->postal->add('The content was updated successfully.', 'success');
}
} else {
$this->postal->add('There is no content to update.', 'error');
}
redirect('admin/contents/index/' . $content->content_type, 'refresh');
}
}
示例13: get_is_uri
function get_is_uri($name, $uri, $tb, $id = 'null')
{
$uri = trim($uri);
$uri = ltrim($uri, 'page');
if (empty($uri)) {
$uri = url_title(mb_strtolower(convert_accented_characters(trim($name))));
} else {
$uri = url_title(mb_strtolower(convert_accented_characters($uri)));
}
$i = 0;
$uris = $uri;
$unuri = $this->uri_is($uri, $tb, $id);
while ($unuri > 0) {
$i++;
$uris = $uri . '_' . $i;
$unuri = $this->uri_is($uris, $tb, $id);
}
return $uris;
}
示例14: category
public function category($id, $page = 0)
{
$this->data['config']["uri_segment"] = 3;
$this->data['main_category'] = $this->category_model->get_data_by_id($id);
$this->data['config']["total_rows"] = $this->product_model->record_count($this->data['sidebar_filters'], $id);
$choice = $this->data['config']["total_rows"] / $this->data['config']["per_page"];
$this->data['config']["num_links"] = round($choice);
$this->data['config']["base_url"] = site_url('categorie/' . url_title(convert_accented_characters($this->data['main_category']->{'name_' . $this->data['language']})) . '-' . $this->data['main_category']->id);
$this->pagination->initialize($this->data['config']);
$this->data['products'] = $this->product_model->fetch_products($this->data['config']["per_page"], $page, $this->data['sidebar_filters'], !empty($_POST['sort_by']) ? $_POST['sort_by'] : false, false, $id);
$this->data['links'] = $this->pagination->create_links();
if (!empty($_POST['ajax'])) {
$this->load->view('partials/products_inside', $this->data);
} else {
$this->load->view('partials/header', $this->data);
$this->load->view('products', $this->data);
$this->load->view('partials/footer', $this->data);
}
}
示例15: url_title
/**
* Create URL Title
*
* Takes a "title" string as input and creates a human-friendly URL string
* with either a dash or an underscore as the word separator.
* Cyrillic alphabet characters are supported.
*
* @param string $str The string
* @param string $separator The separator, dash or underscore.
* @param boolean $lowercase Whether it should be converted to lowercase.
*
* @return string The URL slug
*/
function url_title($str, $separator = 'dash', $lowercase = false)
{
$replace = $separator == 'dash' ? '-' : '_';
$trans = array('&\\#\\d+?;' => '', '&\\S+?;' => '', '\\s+' => $replace, '[^a-z0-9\\-\\._]' => '', $replace . '+' => $replace, $replace . '$' => $replace, '^' . $replace => $replace, '\\.+$' => '');
$str = convert_accented_characters($str);
$str = strip_tags($str);
foreach ($trans as $key => $val) {
$str = preg_replace("#" . $key . "#i", $val, $str);
}
if ($lowercase === true) {
if (function_exists('mb_convert_case')) {
$str = mb_convert_case($str, MB_CASE_LOWER, "UTF-8");
} else {
$str = strtolower($str);
}
}
$CI =& get_instance();
$str = preg_replace('#[^' . $CI->config->item('permitted_uri_chars') . ']#i', '', $str);
return trim(stripslashes($str));
}